@camunda/ccma-saas-frontend 0.11.0 → 0.13.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-cluster-details-clients/c4-cluster-details-clients.d.ts +1 -1
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +11 -1
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.js +2 -0
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.types.d.ts +2 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +24 -2
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +9 -0
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.d.ts +1 -1
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +2 -4
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +0 -4
- package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +9 -1
- package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +5 -5
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +3 -3
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.d.ts +1 -1
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.js +2 -2
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.types.d.ts +5 -0
- package/lib/esm/components/c4-convert-trial-organization-modal/c4-convert-trial-organization-modal.js +1 -11
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +1 -14
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.d.ts +1 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +188 -71
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +52 -0
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +1 -11
- package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js +6 -13
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +1 -11
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +1 -18
- package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js +1 -11
- package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.d.ts +0 -7
- package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.js +1 -24
- package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +1 -18
- package/lib/esm/components/c4-divider/c4-divider.js +12 -0
- package/lib/esm/components/c4-empty-state/c4-empty-state.d.ts +8 -0
- package/lib/esm/components/c4-empty-state/c4-empty-state.js +32 -8
- package/lib/esm/components/c4-file-uploader/c4-file-uploader.d.ts +36 -0
- package/lib/esm/components/c4-file-uploader/c4-file-uploader.js +43 -0
- package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +1 -11
- package/lib/esm/components/c4-leave-organization-modal/c4-leave-organization-modal.js +1 -11
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.d.ts +10 -0
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.js +96 -0
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.d.ts +22 -0
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.js +6 -0
- package/lib/esm/components/c4-rename-organization-modal/c4-rename-organization-modal.js +1 -11
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +50 -0
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +130 -0
- package/lib/esm/externalUrls.const.d.ts +7 -0
- package/lib/esm/externalUrls.const.js +11 -1
- package/lib/esm/i18n/c4-console-i18n.js +3 -0
- package/lib/esm/i18n/en/modals/apiclients.json +2 -1
- package/lib/esm/i18n/en/modals/clusterclients.json +18 -1
- package/lib/esm/i18n/en/pages/clusterdetails.json +12 -7
- package/lib/esm/i18n/en/pages/createcluster.json +43 -0
- package/lib/esm/i18n/en/pages/orgmanagement.json +6 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/runtime/c4-console-runtime-context.d.ts +1 -1
- package/lib/esm/runtime/c4-console-runtime-context.js +2 -2
- package/lib/esm/runtime/cluster-duplication.d.ts +10 -0
- package/lib/esm/runtime/cluster-duplication.js +15 -0
- package/lib/esm/runtime/org-cluster-defaults.d.ts +14 -0
- package/lib/esm/runtime/org-cluster-defaults.js +19 -0
- package/lib/esm/ui/c4-password-input.js +1 -1
- package/lib/esm/ui/index.d.ts +1 -0
- package/lib/esm/ui/index.js +16 -2
- package/lib/esm/utils/role-labels.d.ts +1 -2
- package/lib/esm/utils/role-labels.js +1 -13
- package/lib/esm/utils/safe-translate.d.ts +4 -2
- package/lib/esm/utils/safe-translate.js +9 -2
- package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +80 -23
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +34 -23
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +6 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +7 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +3 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-activity-tab.js +1 -19
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +1 -14
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +1 -18
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +57 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +77 -28
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +1 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +1 -18
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +12 -22
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +1 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +3 -86
- package/lib/esm/widgets/clusters/c4-clusters-page.js +72 -100
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +7 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -9
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +1 -9
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +88 -1
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +285 -45
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +9 -0
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +3 -20
- package/lib/esm/widgets/dashboard/c4-dashboard-app.types.d.ts +6 -0
- package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.js +1 -1
- package/lib/esm/widgets/group-details/c4-group-details-page.js +1 -9
- package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +1 -0
- package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +4 -34
- package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-app.js +99 -23
- package/lib/esm/widgets/management/c4-management-app.types.d.ts +6 -0
- package/lib/esm/widgets/management/c4-management-page.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-page.js +7 -13
- package/lib/esm/widgets/management/c4-management-page.types.d.ts +1 -0
- package/lib/esm/widgets/management/management-tabs.d.ts +1 -1
- package/lib/esm/widgets/management/management-tabs.js +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +1 -13
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -9
- package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.d.ts +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.js +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +1 -13
- package/lib/esm/widgets/management/tabs/c4-management-pricing-tab.js +1 -8
- package/lib/esm/widgets/management/tabs/c4-management-settings-tab.js +1 -24
- package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +1 -13
- package/lib/esm/widgets/user-account/c4-delete-account-widget.js +2 -1
- package/lib/esm/widgets/user-details/c4-user-details-page.js +1 -9
- package/package.json +3 -3
- package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.d.ts +0 -14
- package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.js +0 -12
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { C3ClusterTag, } from '@camunda/camunda-composite-components';
|
|
8
2
|
import { AUTHORIZATION_TOGGLE_MIN_VERSION, ClusterPlanTypeCategory, checkVersion, LINE_8_10_MIN_VERSION, TASKLIST_MODE_TOGGLE_MIN_VERSION, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
9
3
|
import { ChoiceCard, ChoiceCardGroup, Input, Textarea, } from '@camunda/design-system';
|
|
10
4
|
import { Column, FormLabel, Grid, InlineLoading, Stack, TextArea, TextInput, } from '@carbon/react';
|
|
11
5
|
import { ChevronDown, ChevronUp, Code, DataBase } from '@carbon/react/icons/index.esm.js';
|
|
12
|
-
import { useRef, useState } from 'react';
|
|
6
|
+
import { useRef, useState, } from 'react';
|
|
13
7
|
import styled from 'styled-components';
|
|
14
8
|
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
15
|
-
import { Button, Checkbox, Link, SkeletonText, Tag, Tile } from '../../ui/index.js';
|
|
16
|
-
import {
|
|
9
|
+
import { Button, TextInput as C4TextInput, Checkbox, ClusterTag, Link, Modal, SkeletonText, Tag, Tile, } from '../../ui/index.js';
|
|
10
|
+
import { SECTION_HEADING_STYLE } from '../../utils/section-heading-style.js';
|
|
17
11
|
import { C4ClusterTagSelector } from '../c4-cluster-tag-selector/c4-cluster-tag-selector.js';
|
|
18
12
|
import { C4Divider } from '../c4-divider/c4-divider.js';
|
|
19
13
|
import { C4ExternalLink } from '../c4-external-link/c4-external-link.js';
|
|
20
14
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
21
15
|
import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
16
|
+
import { C4SegmentedControl } from '../c4-segmented-control/c4-segmented-control.js';
|
|
22
17
|
import { C4SelectableTile } from '../c4-selectable-tile/c4-selectable-tile.js';
|
|
23
18
|
import { C4CreateClusterTileGrid } from './c4-create-cluster-tile-grid.js';
|
|
24
19
|
var TasklistMode;
|
|
@@ -59,7 +54,29 @@ const getInlineStatusByState = (state) => {
|
|
|
59
54
|
return 'inactive';
|
|
60
55
|
}
|
|
61
56
|
};
|
|
62
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The title of one section of the form.
|
|
59
|
+
*
|
|
60
|
+
* In ds mode the DS stylesheet resets every bare heading tag inside `.c4-ui`
|
|
61
|
+
* to the size and the weight of the body text, thus an `h3` with no style of
|
|
62
|
+
* its own reads as normal text and the page loses its structure. The style
|
|
63
|
+
* below puts the section heading back. Carbon mode keeps the heading style of
|
|
64
|
+
* the host application and does not change.
|
|
65
|
+
*/
|
|
66
|
+
const FormElementTitle = (props) => {
|
|
67
|
+
const designSystem = useC4DesignSystem();
|
|
68
|
+
return (_jsxs("h3", { style: designSystem === 'ds'
|
|
69
|
+
? // `SECTION_HEADING_STYLE` sets `margin: 0`, and the section around
|
|
70
|
+
// the heading gives 4 pixels, thus a toggle group or an input came
|
|
71
|
+
// up against its own title. Every other block of the page keeps 12
|
|
72
|
+
// pixels below its title, which this margin restores.
|
|
73
|
+
{ ...SECTION_HEADING_STYLE, marginBottom: '0.5rem' }
|
|
74
|
+
: undefined, children: [props.title, props.required && designSystem === 'ds' && (_jsx("span", { style: {
|
|
75
|
+
marginLeft: '0.25rem',
|
|
76
|
+
fontWeight: 400,
|
|
77
|
+
color: 'var(--cds-text-secondary)',
|
|
78
|
+
}, children: "(required)" }))] }));
|
|
79
|
+
};
|
|
63
80
|
const ClusterPlanTypeTile = (props) => {
|
|
64
81
|
return (_jsxs(Stack, { gap: 4, children: [props.type === 'dev' ? _jsx(Code, {}) : _jsx(DataBase, {}), _jsx("h6", { children: props.title }), _jsx("p", { children: props.description })] }));
|
|
65
82
|
};
|
|
@@ -69,9 +86,8 @@ const enableMap = {
|
|
|
69
86
|
test: ['dev', 'test'],
|
|
70
87
|
dev: ['dev', 'test'],
|
|
71
88
|
};
|
|
72
|
-
export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, }) => {
|
|
89
|
+
export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, initialValues, duplicate, }) => {
|
|
73
90
|
const designSystem = useC4DesignSystem();
|
|
74
|
-
const { ContentSwitcher, Switch } = useContentSwitcherFamily();
|
|
75
91
|
const preConditions = formElements.clusterPlanType.options.length > 0 &&
|
|
76
92
|
formElements.region.options.length > 0 &&
|
|
77
93
|
formElements.generation.channels.length > 0 &&
|
|
@@ -92,15 +108,23 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
92
108
|
const clusterNameInputFieldRef = useRef(null);
|
|
93
109
|
const clusterDescriptionInputFieldRef = useRef(null);
|
|
94
110
|
const regionSectionRef = useRef(null);
|
|
95
|
-
|
|
96
|
-
|
|
111
|
+
// Each `initialValues` lookup below falls back to the normal default when it
|
|
112
|
+
// finds no option of that uuid. An org can lose access to the generation or
|
|
113
|
+
// the region of the source cluster, and the form must still open.
|
|
114
|
+
const defaultChannel = formElements.generation.channels.find((channel) => channel.uuid === initialValues?.channel) ??
|
|
115
|
+
formElements.generation.channels.find((channel) => channel.default === true) ??
|
|
116
|
+
formElements.generation.channels[0];
|
|
117
|
+
const defaultGeneration = defaultChannel?.generations?.find((generation) => generation.uuid === initialValues?.generation) ??
|
|
118
|
+
defaultChannel?.generations?.find((generation) => generation.default === true) ??
|
|
119
|
+
defaultChannel?.generations?.[0];
|
|
97
120
|
const [selectedChannel, setSelectedChannel] = useState(defaultChannel?.uuid);
|
|
98
121
|
const [selectedGeneration, setSelectedGeneration] = useState(defaultGeneration?.uuid);
|
|
99
|
-
const [clusterName, setClusterName] = useState('');
|
|
100
|
-
const [clusterDescription, setClusterDescription] = useState('');
|
|
101
|
-
const defaultClusterPlanType = formElements.clusterPlanType.options.find((option) => option.
|
|
122
|
+
const [clusterName, setClusterName] = useState(initialValues?.name ?? '');
|
|
123
|
+
const [clusterDescription, setClusterDescription] = useState(initialValues?.description ?? '');
|
|
124
|
+
const defaultClusterPlanType = formElements.clusterPlanType.options.find((option) => option.uuid === initialValues?.clusterPlanType) ??
|
|
125
|
+
formElements.clusterPlanType.options.find((option) => option.default === true && option.disabled === false);
|
|
102
126
|
const [clusterPlanType, setClusterPlanType] = useState(defaultClusterPlanType ? defaultClusterPlanType?.uuid : '');
|
|
103
|
-
const [selectedTag, setSelectedTag] = useState('dev');
|
|
127
|
+
const [selectedTag, setSelectedTag] = useState(initialValues?.stageLabel ?? 'dev');
|
|
104
128
|
const [showOlderGenerations, setShowOlderGenerations] = useState(false);
|
|
105
129
|
const currentClusterPlanType = (clusterPlanType || defaultClusterPlanType?.uuid) ?? '';
|
|
106
130
|
const setClusterPlanTypeWithEffects = (clusterPlanTypeUuid) => {
|
|
@@ -114,17 +138,29 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
114
138
|
}
|
|
115
139
|
};
|
|
116
140
|
const selectedPlan = formElements.clusterPlanType.options.find((option) => option.uuid === clusterPlanType);
|
|
117
|
-
const [tasklistV2Enabled, setTasklistV2Enabled] = useState(true);
|
|
141
|
+
const [tasklistV2Enabled, setTasklistV2Enabled] = useState(initialValues?.tasklistV2Enabled ?? true);
|
|
118
142
|
// depends on cluster type
|
|
119
|
-
const [authorizationEnabled, setAuthorizationEnabled] = useState(
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
143
|
+
const [authorizationEnabled, setAuthorizationEnabled] = useState(initialValues?.identityBackendChecksEnabled ??
|
|
144
|
+
selectedPlan?.type !== 'prod');
|
|
145
|
+
const [numberOfAllocatedHwPackages, setNumberOfAllocatedHwPackages] = useState(initialValues?.numberOfAllocatedHwPackages ?? 1);
|
|
146
|
+
const initialRegion = formElements.region.options.find((option) => option.uuid === initialValues?.region);
|
|
147
|
+
const defaultProvider = initialRegion?.provider ??
|
|
148
|
+
formElements.region.options.find((option) => option.default === true)
|
|
149
|
+
?.provider ??
|
|
150
|
+
formElements.region.options[0]?.provider;
|
|
151
|
+
// The region of a cluster cannot change after the cluster exists, thus the
|
|
152
|
+
// customer must select it themselves. Do not give this state a value from a
|
|
153
|
+
// provider, from an order of options, or from any other guess: the two cases
|
|
154
|
+
// below are the only ones. `initialRegion` is the region of the source
|
|
155
|
+
// cluster of a duplicate, which the customer chose already, and the second
|
|
156
|
+
// case is an org that has one region in total, where there is nothing to
|
|
157
|
+
// decide.
|
|
158
|
+
const defaultRegion = initialRegion?.uuid ??
|
|
159
|
+
(formElements.region.options.length === 1
|
|
160
|
+
? formElements.region.options[0].uuid
|
|
161
|
+
: formElements.region.options.find((option) => option.default === true)
|
|
162
|
+
?.uuid);
|
|
125
163
|
const [region, setRegion] = useState(defaultRegion);
|
|
126
|
-
const defaultProvider = formElements.region.options.find((option) => option.default === true)
|
|
127
|
-
?.provider ?? formElements.region.options[0]?.provider;
|
|
128
164
|
const [provider, setProvider] = useState(defaultProvider);
|
|
129
165
|
const getEncryptionsByProvider = (providerName) => {
|
|
130
166
|
if (providerName === 'AWS') {
|
|
@@ -143,14 +179,23 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
143
179
|
?.uuid ?? '')
|
|
144
180
|
: undefined;
|
|
145
181
|
};
|
|
146
|
-
const
|
|
182
|
+
const initialBackupRegion = initialRegion?.backups.find((backup) => backup.uuid === initialValues?.backupRegion)?.uuid;
|
|
183
|
+
const [backupRegion, setBackupRegion] = useState(initialBackupRegion ?? getDefaultBackupRegion());
|
|
147
184
|
const [encryptions, setEncryptions] = useState(getEncryptionsByProvider(defaultProvider));
|
|
148
185
|
const defaultEncryption = encryptions?.options
|
|
149
|
-
? (encryptions.options.find((enc) => enc.
|
|
186
|
+
? (encryptions.options.find((enc) => enc.value === initialValues?.encryption)?.value ??
|
|
187
|
+
encryptions.options.find((enc) => enc.default)?.value ??
|
|
188
|
+
'')
|
|
150
189
|
: undefined;
|
|
151
190
|
const [encryption, setEncryption] = useState(defaultEncryption);
|
|
191
|
+
const [replaceConfirmOpen, setReplaceConfirmOpen] = useState(false);
|
|
192
|
+
const [replaceConfirmation, setReplaceConfirmation] = useState('');
|
|
152
193
|
const [submitState, setSubmitState] = useState('idle');
|
|
153
|
-
|
|
194
|
+
// The message of the field that stops the submit. The form is longer than
|
|
195
|
+
// one screen and the CTA is at its end, thus the reader kept the CTA in view
|
|
196
|
+
// and never saw the error at the field. This message shows at the CTA too.
|
|
197
|
+
const [submitBlockedMessage, setSubmitBlockedMessage] = useState(undefined);
|
|
198
|
+
const [autoUpdateChecked, setAutoUpdateChecked] = useState(initialValues?.autoUpdate ?? (autoUpdate?.default || false));
|
|
154
199
|
const [autoUpdateEnabled, setAutoUpdateEnabled] = useState(formElements?.autoUpdate?.shouldBeEnabled(selectedChannel) ?? false);
|
|
155
200
|
const noAvailableSlots = (submitState === 'idle' &&
|
|
156
201
|
formElements.clusterPlanType.options.every((option) => option.disabled)) ??
|
|
@@ -159,8 +204,6 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
159
204
|
const updateNumberOfAllocatedHwPackages = (value) => {
|
|
160
205
|
setNumberOfAllocatedHwPackages(value);
|
|
161
206
|
};
|
|
162
|
-
const getChannelIndex = (channelUuid) => formElements.generation.channels.findIndex((channel) => channel.uuid === channelUuid);
|
|
163
|
-
const defaultChannelIndex = getChannelIndex(defaultChannel?.uuid);
|
|
164
207
|
const getSelectedChannel = () => {
|
|
165
208
|
const foundChannel = formElements.generation.channels.find((channel) => channel.uuid === selectedChannel);
|
|
166
209
|
return foundChannel;
|
|
@@ -180,7 +223,12 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
180
223
|
const updateProvider = (providerName) => {
|
|
181
224
|
if (provider !== providerName) {
|
|
182
225
|
setProvider(providerName);
|
|
183
|
-
|
|
226
|
+
// A change of provider clears the region, and does not select the first
|
|
227
|
+
// region of the new provider. A cluster keeps its region for its whole
|
|
228
|
+
// life, thus the customer says which one they want. The regions of the
|
|
229
|
+
// new provider are different places, so the earlier selection cannot
|
|
230
|
+
// carry over either.
|
|
231
|
+
updateRegion(undefined);
|
|
184
232
|
const providerEncryptions = getEncryptionsByProvider(providerName);
|
|
185
233
|
setEncryptions(providerEncryptions);
|
|
186
234
|
updateEncryption(providerEncryptions?.options.find((enc) => enc.default)?.value ??
|
|
@@ -192,9 +240,11 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
192
240
|
.map((option) => option.provider)
|
|
193
241
|
.filter((value, index, array) => array.lastIndexOf(value) === index)
|
|
194
242
|
.sort((a, b) => a.localeCompare(b));
|
|
243
|
+
/** `undefined` clears the selection, which a change of provider does. */
|
|
195
244
|
const updateRegion = (regionUuid) => {
|
|
196
245
|
setRegion(regionUuid);
|
|
197
246
|
setRegionValidation({ isValid: true, message: '' });
|
|
247
|
+
setSubmitBlockedMessage(undefined);
|
|
198
248
|
const region = formElements.region.options.find((region) => region.uuid === regionUuid);
|
|
199
249
|
if (region) {
|
|
200
250
|
const defaultDualRegionBackups = formElements.region.dualRegionBackups
|
|
@@ -215,8 +265,29 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
215
265
|
};
|
|
216
266
|
const updateClusterName = (name) => {
|
|
217
267
|
setClusterNameValidation({ isValid: true, message: '' });
|
|
268
|
+
setSubmitBlockedMessage(undefined);
|
|
218
269
|
setClusterName(name);
|
|
219
270
|
};
|
|
271
|
+
/**
|
|
272
|
+
* Brings the section that stops the submit into view, puts the focus on its
|
|
273
|
+
* first control, and keeps the message at the CTA.
|
|
274
|
+
*
|
|
275
|
+
* `scrollIntoView` and not `window.scrollTo`: the page can sit in a scroll
|
|
276
|
+
* container of the host application, and a scroll of the window then moves
|
|
277
|
+
* nothing. The focus also tells a screen reader which field has the problem.
|
|
278
|
+
*/
|
|
279
|
+
const revealValidationError = (sectionRef, message) => {
|
|
280
|
+
setSubmitBlockedMessage(message);
|
|
281
|
+
const node = sectionRef.current;
|
|
282
|
+
if (!node) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (typeof node.scrollIntoView === 'function') {
|
|
286
|
+
node.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
287
|
+
}
|
|
288
|
+
const firstControl = node.querySelector('input:not([type="hidden"]), textarea, [role="radio"]');
|
|
289
|
+
firstControl?.focus({ preventScroll: true });
|
|
290
|
+
};
|
|
220
291
|
const getClusterPlanType = () => {
|
|
221
292
|
const foundClusterPlanType = formElements.clusterPlanType.options.find((currentClusterPlanType) => currentClusterPlanType.uuid === clusterPlanType);
|
|
222
293
|
return foundClusterPlanType ?? defaultClusterPlanType;
|
|
@@ -251,18 +322,12 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
251
322
|
return submitState === 'submitting';
|
|
252
323
|
};
|
|
253
324
|
const handleSubmit = async () => {
|
|
325
|
+
setSubmitBlockedMessage(undefined);
|
|
254
326
|
// validation
|
|
255
327
|
const validationResponse = formElements.name.validation(clusterName);
|
|
256
328
|
if (!validationResponse.isValid) {
|
|
257
329
|
setClusterNameValidation(validationResponse);
|
|
258
|
-
|
|
259
|
-
if (rect) {
|
|
260
|
-
const y = rect?.top + window.scrollY;
|
|
261
|
-
window.scrollTo({
|
|
262
|
-
top: y - 150,
|
|
263
|
-
behavior: 'smooth',
|
|
264
|
-
});
|
|
265
|
-
}
|
|
330
|
+
revealValidationError(clusterNameInputFieldRef, validationResponse.message);
|
|
266
331
|
return;
|
|
267
332
|
}
|
|
268
333
|
// validate description if validation function is provided
|
|
@@ -270,35 +335,38 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
270
335
|
const descriptionValidationResponse = formElements.description.validation(clusterDescription);
|
|
271
336
|
if (!descriptionValidationResponse.isValid) {
|
|
272
337
|
setClusterDescriptionValidation(descriptionValidationResponse);
|
|
273
|
-
|
|
274
|
-
if (rect) {
|
|
275
|
-
const y = rect?.top + window.scrollY;
|
|
276
|
-
window.scrollTo({
|
|
277
|
-
top: y - 150,
|
|
278
|
-
behavior: 'smooth',
|
|
279
|
-
});
|
|
280
|
-
}
|
|
338
|
+
revealValidationError(clusterDescriptionInputFieldRef, descriptionValidationResponse.message);
|
|
281
339
|
return;
|
|
282
340
|
}
|
|
283
341
|
}
|
|
284
342
|
// validate region selection
|
|
285
343
|
if (!region) {
|
|
344
|
+
const regionMessage = formElements.region.validationMessage ?? 'Please select a region';
|
|
286
345
|
setRegionValidation({
|
|
287
346
|
isValid: false,
|
|
288
|
-
message:
|
|
347
|
+
message: regionMessage,
|
|
289
348
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
349
|
+
revealValidationError(regionSectionRef, regionMessage);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
// A replace deletes the source cluster and its data. The customer confirms
|
|
353
|
+
// that in the modal below, which then calls `submitForm`.
|
|
354
|
+
if (duplicate?.replace?.checked) {
|
|
355
|
+
setReplaceConfirmation('');
|
|
356
|
+
setReplaceConfirmOpen(true);
|
|
298
357
|
return;
|
|
299
358
|
}
|
|
359
|
+
await submitForm();
|
|
360
|
+
};
|
|
361
|
+
const submitForm = async () => {
|
|
300
362
|
const currentClusterPlanType = (clusterPlanType || defaultClusterPlanType?.uuid) ?? '';
|
|
301
363
|
const selectedRegion = region;
|
|
364
|
+
// `handleSubmit` reports a missing region to the customer and stops before
|
|
365
|
+
// this point. The confirm modal calls this function later, thus the guard
|
|
366
|
+
// is here again.
|
|
367
|
+
if (!selectedRegion) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
302
370
|
setSubmitState('submitting');
|
|
303
371
|
const success = await cta.create({
|
|
304
372
|
name: clusterName,
|
|
@@ -394,6 +462,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
394
462
|
// for the summary panel in ds dark mode; force the primary text token there.
|
|
395
463
|
// Carbon keeps FormLabel's own default (unchanged) by leaving style undefined.
|
|
396
464
|
const summaryLabelStyle = designSystem === 'ds' ? { color: 'var(--cds-text-primary)' } : undefined;
|
|
465
|
+
const summaryHeadingStyle = designSystem === 'ds' ? SECTION_HEADING_STYLE : undefined;
|
|
397
466
|
return (_jsxs("div", { style: {
|
|
398
467
|
display: 'grid',
|
|
399
468
|
gridAutoFlow: 'row',
|
|
@@ -401,7 +470,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
401
470
|
overflow: 'hidden',
|
|
402
471
|
zIndex: 1,
|
|
403
472
|
minHeight: '572px',
|
|
404
|
-
}, 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(
|
|
473
|
+
}, children: [_jsxs("div", { children: [_jsx("h6", { style: summaryHeadingStyle, children: "Summary" }), _jsx(C4Divider, {}), _jsxs(Stack, { gap: 4, children: [loading ? (_jsx(SkeletonText, {})) : (_jsxs("h6", { style: summaryHeadingStyle, 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(ClusterTag, { stage: summary.stageTag }) }))] })] })] }), !loading && (_jsx("div", { style: { alignSelf: 'end' }, children: _jsx("div", { children: _jsxs(Stack, { gap: 3, children: [submitBlockedMessage && submitState === 'idle' && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, hideCloseButton: true, style: { minWidth: '0' }, title: submitBlockedMessage })), ['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: () => {
|
|
405
474
|
if (cta.cancel) {
|
|
406
475
|
cta.cancel.onClick();
|
|
407
476
|
}
|
|
@@ -420,10 +489,18 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
420
489
|
if (!(authorizationToggle?.enabled && generationIs8_8OrAbove())) {
|
|
421
490
|
return null;
|
|
422
491
|
}
|
|
423
|
-
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: [_jsx(C4CreateClusterTileGrid, { items: AUTHORIZATION_OPTIONS, getKey: (option) => option.value, getLabel: (option) => option.label, value: authorizationEnabled ? 'true' : 'false', onChange: (selection) => setAuthorizationEnabled(selection === 'true'), ariaLabel: authorizationToggle?.title ?? 'Authorization', columnWidth: '240px' }), _jsxs("div", { children: [_jsx("p", { children: "When enabled,
|
|
492
|
+
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: [_jsx(C4CreateClusterTileGrid, { items: AUTHORIZATION_OPTIONS, getKey: (option) => option.value, getLabel: (option) => option.label, value: authorizationEnabled ? 'true' : 'false', onChange: (selection) => setAuthorizationEnabled(selection === 'true'), ariaLabel: authorizationToggle?.title ?? 'Authorization', columnWidth: '240px' }), _jsxs("div", { children: [_jsx("p", { children: "When enabled, only authorized users and clients have access to the cluster." }), _jsxs("p", { children: ["When disabled, all users and clients 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." }) }))] }) }) })] }));
|
|
424
493
|
};
|
|
494
|
+
/**
|
|
495
|
+
* ds-mode only. Marks the option that the form selects on its own.
|
|
496
|
+
*
|
|
497
|
+
* The reader could not tell why one card came pre-selected, thus the badge
|
|
498
|
+
* says that Camunda recommends it. Carbon gets no badge, so its render does
|
|
499
|
+
* not change.
|
|
500
|
+
*/
|
|
501
|
+
const getRecommendedBadge = (option) => designSystem === 'ds' && option.default ? (_jsx(Tag, { type: 'blue', size: 'sm', children: "Recommended" })) : undefined;
|
|
425
502
|
const renderGenerationTiles = (generations) => {
|
|
426
|
-
return (_jsx(C4CreateClusterTileGrid, { items: generations, getKey: (generation) => generation.uuid, getLabel: (generation) => generation.title, getDisabled: () => isSubmitting() || noAvailableSlots, value: selectedGeneration, onChange: updateSelectedGeneration, ariaLabel: 'Select generation', columnWidth: '200px', searchPlaceholder: 'Search generations' }, selectedChannel));
|
|
503
|
+
return (_jsx(C4CreateClusterTileGrid, { items: generations, getKey: (generation) => generation.uuid, getLabel: (generation) => generation.title, getBadge: getRecommendedBadge, getDisabled: () => isSubmitting() || noAvailableSlots, value: selectedGeneration, onChange: updateSelectedGeneration, ariaLabel: 'Select generation', columnWidth: '200px', searchPlaceholder: 'Search generations' }, selectedChannel));
|
|
427
504
|
};
|
|
428
505
|
const renderGenerationSection = () => {
|
|
429
506
|
const allGenerations = getSelectedChannel()?.generations ?? [];
|
|
@@ -469,26 +546,50 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
469
546
|
if (!preConditions) {
|
|
470
547
|
return (_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: "Something went wrong. Please try again later." }) }) }));
|
|
471
548
|
}
|
|
472
|
-
return (_jsxs(Stack, { gap: 6, children: [
|
|
549
|
+
return (_jsxs(Stack, { gap: 6, children: [duplicate && (_jsx(C4InlineNotification, { kind: 'info', hideCloseButton: true, style: { minWidth: '0' }, title: duplicate.sourceName, subtitle: duplicate.notice })), noAvailableSlots && (_jsx(C4InlineNotification, { kind: 'warning', hideCloseButton: true, style: { minWidth: '0' }, title: noSlotsLeft.title, subtitle: noSlotsLeft.description })), duplicate?.replace && (_jsxs(Stack, { gap: 2, children: [_jsx(Checkbox, { id: 'duplicate-replace-source', labelText: duplicate.replace.label, checked: duplicate.replace.checked, disabled: isSubmitting(), onChange: (event) => {
|
|
550
|
+
duplicate.replace?.onChange(event.target.checked);
|
|
551
|
+
} }), _jsx("p", { style: { color: 'var(--cds-text-secondary)' }, children: duplicate.replace.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', defaultValue: clusterName, placeholder: formElements.name.placeholder, "aria-invalid": !clusterNameValidation.isValid || undefined, disabled: isSubmitting() || noAvailableSlots,
|
|
552
|
+
// The name is the first thing the reader gives, and the
|
|
553
|
+
// page opened with no field in focus.
|
|
554
|
+
// biome-ignore lint/a11y/noAutofocus: the field is the
|
|
555
|
+
// first control of a full-page form
|
|
556
|
+
autoFocus: true,
|
|
557
|
+
// A cluster name is not a personal detail, thus the
|
|
558
|
+
// browser must not offer the names from other forms.
|
|
559
|
+
autoComplete: 'off', onChange: (event) => updateClusterName(event.target.value) }), !clusterNameValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-foreground-subtle', children: clusterNameValidation.message }))] })) : (_jsx(TextInput, { invalidText: clusterNameValidation.message, invalid: !clusterNameValidation.isValid, type: 'text', id: 'cluster-name', defaultValue: clusterName, 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', defaultValue: clusterDescription, placeholder: formElements.description.placeholder, rows: 3, "aria-invalid": !clusterDescriptionValidation.isValid || undefined, disabled: isSubmitting() || noAvailableSlots, autoComplete: 'off', onChange: (event) => {
|
|
473
560
|
setClusterDescriptionValidation({
|
|
474
561
|
isValid: true,
|
|
475
562
|
message: '',
|
|
476
563
|
});
|
|
564
|
+
setSubmitBlockedMessage(undefined);
|
|
477
565
|
setClusterDescription(event.target.value);
|
|
478
|
-
} }), !clusterDescriptionValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-
|
|
566
|
+
} }), !clusterDescriptionValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-foreground-subtle', children: clusterDescriptionValidation.message }))] })) : (_jsx(TextArea, { id: 'cluster-description', defaultValue: clusterDescription, placeholder: formElements.description.placeholder, onChange: (event) => {
|
|
479
567
|
setClusterDescriptionValidation({
|
|
480
568
|
isValid: true,
|
|
481
569
|
message: '',
|
|
482
570
|
});
|
|
571
|
+
setSubmitBlockedMessage(undefined);
|
|
483
572
|
setClusterDescription(event.target.value);
|
|
484
|
-
}, 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: {
|
|
573
|
+
}, 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, required: true }), !regionValidation.isValid && (_jsx("p", { style: {
|
|
485
574
|
color: 'var(--cds-text-error)',
|
|
486
575
|
marginTop: '0.25rem',
|
|
487
576
|
marginBottom: '0.5rem',
|
|
488
|
-
}, children: regionValidation.message })), getUniqueProviders().length > 1 && (
|
|
577
|
+
}, children: regionValidation.message })), getUniqueProviders().length > 1 && (
|
|
578
|
+
// Each mode takes its own spacing, thus carbon keeps the
|
|
579
|
+
// `ContentSwitcher` as the direct child of this column, with
|
|
580
|
+
// the margin on the component itself — the render it had
|
|
581
|
+
// before this component existed.
|
|
582
|
+
_jsx(C4SegmentedControl, { options: getUniqueProviders().map((name) => ({
|
|
583
|
+
id: name,
|
|
584
|
+
label: name,
|
|
585
|
+
})), value: provider, onChange: updateProvider, ariaLabel: 'Select cloud provider', carbonStyle: {
|
|
489
586
|
width: `${7 * getUniqueProviders().length}rem`,
|
|
490
587
|
marginBottom: '0.5rem',
|
|
491
|
-
},
|
|
588
|
+
}, dsStyle: { marginBottom: '0.5rem' } }))] }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4CreateClusterTileGrid, { items: formElements.region.options.filter((option) => option.provider === provider), getKey: (option) => option.uuid, getLabel: (option) => option.title,
|
|
589
|
+
// No badge on a region. Camunda recommends no region, and a
|
|
590
|
+
// mark on one card would push the customer to a choice that
|
|
591
|
+
// they cannot change after the cluster exists.
|
|
592
|
+
getDisabled: () => isSubmitting() || noAvailableSlots, value: region, onChange: updateRegion, ariaLabel: formElements.region.title, columnWidth: '220px', searchPlaceholder: 'Search regions' }, provider) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: formElements.region.description }) }) })] }), (() => {
|
|
492
593
|
if (formElements.region.dualRegionBackups) {
|
|
493
594
|
const selectedRegion = formElements.region.options.find((reg) => reg.uuid === region);
|
|
494
595
|
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(C4CreateClusterTileGrid, { items: selectedRegion?.backups ?? [], getKey: (option) => option.uuid, getLabel: (option) => `${option.regions.length > 1
|
|
@@ -539,10 +640,16 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
539
640
|
}
|
|
540
641
|
}, save: { allowed: !noAvailableSlots }, currentStage: selectedTag, allowedTags: selectedPlan?.type
|
|
541
642
|
? enableMap[selectedPlan?.type]
|
|
542
|
-
: enableMap.prod }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: formElements.stageLabel.textBelow }) }) })] }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style:
|
|
643
|
+
: enableMap.prod }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: formElements.stageLabel.textBelow }) }) })] }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style: designSystem === 'ds'
|
|
644
|
+
? { marginBottom: '0.5rem' }
|
|
645
|
+
: { overflowX: 'auto', marginBottom: '0.5rem' }, children: _jsx(C4SegmentedControl, { options: formElements.generation.channels.map((channel) => ({
|
|
646
|
+
id: channel.uuid,
|
|
647
|
+
label: channel.title,
|
|
648
|
+
disabled: noAvailableSlots,
|
|
649
|
+
})), value: selectedChannel, onChange: updateSelectedChannel, ariaLabel: formElements.generation.title, carbonStyle: {
|
|
543
650
|
height: '100%',
|
|
544
651
|
width: `${7 * formElements.generation.channels.length}rem`,
|
|
545
|
-
}
|
|
652
|
+
} }) }), getSelectedChannel() && (_jsxs(Stack, { gap: 4, children: [_jsx(Grid, { children: _jsx(Column, { span: 7, children: _jsx("p", { children: getSelectedChannel()?.description }) }) }), renderGenerationSection()] }))] }) }) }), authorizationToggle?.enabled && renderAuthorizationRadio(), tasklistModeToggle?.enabled && renderTasklistV2Content(), autoUpdate?.enabled && (_jsxs(_Fragment, { children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) }), _jsxs(Stack, { gap: 2, children: [_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(FormElementTitle, { title: formElements.autoUpdate?.title ?? '' }) }) }), autoUpdateEnabled && (_jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(Checkbox, { id: 'autoupdate', labelText: formElements.autoUpdate?.label ?? '', checked: autoUpdateChecked, onChange: (event) => {
|
|
546
653
|
setAutoUpdateChecked(event.target.checked);
|
|
547
654
|
}, disabled: isSubmitting() || !autoUpdateEnabled || noAvailableSlots }, 'autoupdate') }) })), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx("p", { children: autoUpdateEnabled
|
|
548
655
|
? formElements.autoUpdate?.description
|
|
@@ -550,7 +657,17 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
550
657
|
window.open(encryptions?.link.url ?? '', '_blank');
|
|
551
658
|
} })] }) }) }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4CreateClusterTileGrid, { items: encryptions.options, getKey: (option) => option.value, getLabel: (option) => option.title, getDescription: (option) => option.description, value: encryption, onChange: updateEncryption, ariaLabel: encryptions.title, columnWidth: '280px', searchPlaceholder: 'Search encryption options' }) }) })] })] }), _jsx(Grid, { children: _jsx(Column, { span: 12, children: _jsx(C4Divider, {}) }) })] }))] }));
|
|
552
659
|
};
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
660
|
+
const renderReplaceConfirmModal = () => {
|
|
661
|
+
const replace = duplicate?.replace;
|
|
662
|
+
if (!replace) {
|
|
663
|
+
return undefined;
|
|
664
|
+
}
|
|
665
|
+
return (_jsx(Modal, { open: replaceConfirmOpen, danger: true, modalHeading: replace.confirm.heading, primaryButtonText: replace.confirm.primaryButtonText, secondaryButtonText: replace.confirm.secondaryButtonText, primaryButtonDisabled: replaceConfirmation.trim() !== replace.confirm.confirmationValue, onRequestClose: () => setReplaceConfirmOpen(false), onRequestSubmit: () => {
|
|
666
|
+
setReplaceConfirmOpen(false);
|
|
667
|
+
void submitForm();
|
|
668
|
+
}, children: _jsxs(Stack, { gap: 5, children: [_jsx("p", { children: replace.confirm.body }), _jsx(C4TextInput, { id: 'duplicate-replace-confirmation', labelText: replace.confirm.confirmationLabel, value: replaceConfirmation, onChange: (event) => setReplaceConfirmation(event.target.value) })] }) }));
|
|
669
|
+
};
|
|
670
|
+
return (_jsx(Grid, { style: { maxWidth: '1584px' }, children: _jsx(Column, { span: 16, children: _jsxs(Stack, { gap: 8, children: [renderReplaceConfirmModal(), _jsxs(Grid, { fullWidth: true, narrow: true, children: [_jsxs(Column, { span: 12, children: [renderContent(), !loading && preConditions && (_jsx(SummaryMobileWrapper, { children: _jsx(Tile, { children: renderSummary() }) }))] }), !loading && preConditions && (_jsx(SummaryDesktopWrapper, { children: _jsx(Column, { sm: { span: 4, start: 13 }, children: _jsx(Tile, { style: {
|
|
671
|
+
minWidth: '243px',
|
|
672
|
+
}, children: renderSummary() }) }) }))] })] }) }) }));
|
|
556
673
|
};
|
|
@@ -66,11 +66,63 @@ export interface C4CreateClusterChannelWithGenerations {
|
|
|
66
66
|
classification?: 'channel' | 'existingCluster' | 'orgUnlocked';
|
|
67
67
|
}>;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Shown when the page makes a duplicate of an existing cluster. Omit it and the
|
|
71
|
+
* page is the normal create page.
|
|
72
|
+
*/
|
|
73
|
+
/**
|
|
74
|
+
* Offers to delete the source cluster once the new cluster exists. Give it when
|
|
75
|
+
* the org holds no free reservation and the customer can delete a cluster.
|
|
76
|
+
* Then the customer can duplicate a cluster on a plan that holds one
|
|
77
|
+
* reservation, such as a trial.
|
|
78
|
+
*
|
|
79
|
+
* The state lives in the page, because the reservation count of each plan type
|
|
80
|
+
* changes with it.
|
|
81
|
+
*/
|
|
82
|
+
export interface C4CreateClusterDuplicateReplace {
|
|
83
|
+
label: string;
|
|
84
|
+
description: string;
|
|
85
|
+
checked: boolean;
|
|
86
|
+
onChange: (checked: boolean) => void;
|
|
87
|
+
/**
|
|
88
|
+
* The step before the form is sent. A replace deletes a cluster and its
|
|
89
|
+
* data, thus the customer confirms it in the same way as a delete: by typing
|
|
90
|
+
* `confirmationValue`.
|
|
91
|
+
*/
|
|
92
|
+
confirm: {
|
|
93
|
+
heading: string;
|
|
94
|
+
body: string;
|
|
95
|
+
confirmationLabel: string;
|
|
96
|
+
confirmationValue: string;
|
|
97
|
+
primaryButtonText: string;
|
|
98
|
+
secondaryButtonText: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface C4CreateClusterDuplicate {
|
|
102
|
+
/** The name of the source cluster, for the heading of the notice. */
|
|
103
|
+
sourceName: string;
|
|
104
|
+
/**
|
|
105
|
+
* Says what a duplicate copies and what it does not copy. A string, because
|
|
106
|
+
* the `subtitle` of a Carbon notification accepts no node.
|
|
107
|
+
*/
|
|
108
|
+
notice: string;
|
|
109
|
+
replace?: C4CreateClusterDuplicateReplace;
|
|
110
|
+
}
|
|
69
111
|
export interface C4CreateClusterProps {
|
|
70
112
|
loading?: boolean;
|
|
71
113
|
features?: {
|
|
72
114
|
identityIntegration?: boolean;
|
|
73
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* The first value of each form field. A value that names an option which is
|
|
118
|
+
* not in `formElements` is dropped, thus a cluster on a generation that the
|
|
119
|
+
* org can no longer select still opens the form.
|
|
120
|
+
*
|
|
121
|
+
* The form stays uncontrolled after the first render: these values seed the
|
|
122
|
+
* state and never write over what the customer types.
|
|
123
|
+
*/
|
|
124
|
+
initialValues?: Partial<C4CreateClusterCtaParameters>;
|
|
125
|
+
duplicate?: C4CreateClusterDuplicate;
|
|
74
126
|
banner: {
|
|
75
127
|
noSlotsLeft: {
|
|
76
128
|
title: string;
|
package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js
CHANGED
|
@@ -6,19 +6,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
6
6
|
*/
|
|
7
7
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
8
8
|
import { Checkbox, Form, Link, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
9
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
9
10
|
import { C4ClusterClientCredentialsModal } from '../c4-cluster-client-credentials/c4-cluster-client-credentials.js';
|
|
10
11
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
11
|
-
function safeTranslate(t, key, defaultValue, options) {
|
|
12
|
-
if (!t)
|
|
13
|
-
return defaultValue;
|
|
14
|
-
try {
|
|
15
|
-
const translated = t(key, options);
|
|
16
|
-
return typeof translated === 'string' ? translated : defaultValue;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return defaultValue;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
12
|
function isClientNameValid(name) {
|
|
23
13
|
if (!name.trim()) {
|
|
24
14
|
return false;
|
package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js
CHANGED
|
@@ -7,18 +7,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { SECRETS_MAX_LENGTH } from '@camunda/ccma-shared-types';
|
|
8
8
|
import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
|
|
9
9
|
import { Form, Modal, PasswordInput, Stack, TextInput } from '../../ui/index.js';
|
|
10
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
10
11
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
11
|
-
function safeTranslate(t, key, defaultValue, options) {
|
|
12
|
-
if (!t)
|
|
13
|
-
return defaultValue;
|
|
14
|
-
try {
|
|
15
|
-
const translated = t(key, options);
|
|
16
|
-
return typeof translated === 'string' ? translated : defaultValue;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return defaultValue;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
12
|
export const C4CreateConnectorSecretModal = forwardRef(({ t, onCreateSecret }, ref) => {
|
|
23
13
|
const [isOpen, setIsOpen] = useState(false);
|
|
24
14
|
const [orgId, setOrgId] = useState('');
|
|
@@ -80,13 +70,16 @@ export const C4CreateConnectorSecretModal = forwardRef(({ t, onCreateSecret }, r
|
|
|
80
70
|
}
|
|
81
71
|
})();
|
|
82
72
|
}, [close, clusterId, onCreateSecret, orgId, secretKey, secretValue]);
|
|
83
|
-
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,
|
|
73
|
+
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,
|
|
74
|
+
// The key of a connector secret is not a personal detail, thus the
|
|
75
|
+
// browser must not offer the values of other forms here.
|
|
76
|
+
autoComplete: 'off', onChange: (event) => {
|
|
84
77
|
const next = event.target.value;
|
|
85
78
|
setSecretKey(next);
|
|
86
79
|
if (secretKeyInvalid && next.trim().length > 0) {
|
|
87
80
|
setSecretKeyInvalid(false);
|
|
88
81
|
}
|
|
89
|
-
} }), _jsx(PasswordInput, { id: 'c4-secret-create-value', labelText: safeTranslate(t, 'connectorsecrets:create.fields.value', 'Value'), maxLength: SECRETS_MAX_LENGTH, value: secretValue, invalid: secretValueInvalid, invalidText: 'Value is required', disabled: saving, onChange: (event) => {
|
|
82
|
+
} }), _jsx(PasswordInput, { id: 'c4-secret-create-value', labelText: safeTranslate(t, 'connectorsecrets:create.fields.value', 'Value'), maxLength: SECRETS_MAX_LENGTH, value: secretValue, invalid: secretValueInvalid, invalidText: 'Value is required', disabled: saving, autoComplete: 'new-password', onChange: (event) => {
|
|
90
83
|
const next = event.target.value;
|
|
91
84
|
setSecretValue(next);
|
|
92
85
|
if (secretValueInvalid && next.length > 0) {
|