@camunda/ccma-saas-frontend 0.22.15 → 0.23.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-create-cluster/c4-create-cluster.d.ts +1 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +54 -6
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +20 -0
- package/lib/esm/i18n/en/pages/createcluster.json +17 -0
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/runtime/self-managed-migration.d.ts +2 -0
- package/lib/esm/runtime/self-managed-migration.js +7 -0
- package/lib/esm/utils/migration-workaround.d.ts +24 -0
- package/lib/esm/utils/migration-workaround.js +38 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +7 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +58 -3
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { C4CreateClusterProps } from './c4-create-cluster.types.js';
|
|
3
|
-
export declare const C4CreateCluster: ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, initialValues, duplicate, }: C4CreateClusterProps) => JSX.Element;
|
|
3
|
+
export declare const C4CreateCluster: ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, initialValues, duplicate, migration, }: C4CreateClusterProps) => JSX.Element;
|
|
@@ -96,7 +96,7 @@ const enableMap = {
|
|
|
96
96
|
};
|
|
97
97
|
// The radio value of "no unlocked plan". A plan uuid never has this value.
|
|
98
98
|
const PLAN_TYPE_DEFAULT = 'default';
|
|
99
|
-
export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, initialValues, duplicate, }) => {
|
|
99
|
+
export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, initialValues, duplicate, migration, }) => {
|
|
100
100
|
const preConditions = formElements.clusterPlanType.options.length > 0 &&
|
|
101
101
|
formElements.region.options.length > 0 &&
|
|
102
102
|
formElements.generation.channels.length > 0 &&
|
|
@@ -116,6 +116,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
116
116
|
message: '',
|
|
117
117
|
});
|
|
118
118
|
const clusterNameInputFieldRef = useRef(null);
|
|
119
|
+
const roleArnFieldRef = useRef(null);
|
|
119
120
|
const clusterDescriptionInputFieldRef = useRef(null);
|
|
120
121
|
const regionSectionRef = useRef(null);
|
|
121
122
|
const ttlUnlimitedReasonFieldRef = useRef(null);
|
|
@@ -133,6 +134,18 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
133
134
|
const [selectedChannel, setSelectedChannel] = useState(defaultChannel?.uuid);
|
|
134
135
|
const [selectedGeneration, setSelectedGeneration] = useState(defaultGeneration?.uuid);
|
|
135
136
|
const [clusterName, setClusterName] = useState(initialValues?.name ?? '');
|
|
137
|
+
const [migrationChecked, setMigrationChecked] = useState(false);
|
|
138
|
+
// The migration supports AWS only. An org with no AWS region has no way to
|
|
139
|
+
// finish the form, so it gets no option.
|
|
140
|
+
const migrationOffered = migration !== undefined &&
|
|
141
|
+
formElements.region.options.some((option) => option.provider === 'AWS');
|
|
142
|
+
// The host can remove the option while the box is ticked.
|
|
143
|
+
const migrationOn = migrationChecked && migrationOffered;
|
|
144
|
+
const [roleArn, setRoleArn] = useState('');
|
|
145
|
+
const [roleArnValidation, setRoleArnValidation] = useState({
|
|
146
|
+
isValid: true,
|
|
147
|
+
message: '',
|
|
148
|
+
});
|
|
136
149
|
const [clusterDescription, setClusterDescription] = useState(initialValues?.description ?? '');
|
|
137
150
|
const defaultClusterPlanType = formElements.clusterPlanType.options.find((option) => option.uuid === initialValues?.clusterPlanType) ??
|
|
138
151
|
formElements.clusterPlanType.options.find((option) => option.default === true && option.disabled === false);
|
|
@@ -265,6 +278,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
265
278
|
};
|
|
266
279
|
const providerSupportsEncryption = () => encryption !== undefined;
|
|
267
280
|
const getUniqueProviders = () => formElements.region.options
|
|
281
|
+
.filter((option) => !migrationOn || option.provider === 'AWS')
|
|
268
282
|
.map((option) => option.provider)
|
|
269
283
|
.filter((value, index, array) => array.lastIndexOf(value) === index)
|
|
270
284
|
.sort((a, b) => a.localeCompare(b));
|
|
@@ -366,14 +380,22 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
366
380
|
const handleSubmit = async () => {
|
|
367
381
|
setSubmitBlockedMessage(undefined);
|
|
368
382
|
// validation
|
|
369
|
-
const validationResponse = formElements.name.validation(clusterName);
|
|
383
|
+
const validationResponse = (migrationOn ? migration.nameValidation : formElements.name.validation)(clusterName);
|
|
370
384
|
if (!validationResponse.isValid) {
|
|
371
385
|
setClusterNameValidation(validationResponse);
|
|
372
386
|
revealValidationError(clusterNameInputFieldRef, validationResponse.message);
|
|
373
387
|
return;
|
|
374
388
|
}
|
|
389
|
+
if (migrationOn) {
|
|
390
|
+
const arnResponse = migration.roleArnValidation(roleArn.trim());
|
|
391
|
+
if (!arnResponse.isValid) {
|
|
392
|
+
setRoleArnValidation(arnResponse);
|
|
393
|
+
revealValidationError(roleArnFieldRef, arnResponse.message);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
375
397
|
// validate description if validation function is provided
|
|
376
|
-
if (formElements.description?.validation) {
|
|
398
|
+
if (!migrationOn && formElements.description?.validation) {
|
|
377
399
|
const descriptionValidationResponse = formElements.description.validation(clusterDescription);
|
|
378
400
|
if (!descriptionValidationResponse.isValid) {
|
|
379
401
|
setClusterDescriptionValidation(descriptionValidationResponse);
|
|
@@ -381,8 +403,11 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
381
403
|
return;
|
|
382
404
|
}
|
|
383
405
|
}
|
|
384
|
-
// validate region selection
|
|
385
|
-
|
|
406
|
+
// validate region selection. A migration needs an AWS region.
|
|
407
|
+
const regionOfCluster = formElements.region.options.find((option) => option.uuid === region);
|
|
408
|
+
// The region list can change between the tick and the submit, so a
|
|
409
|
+
// migration checks its region again here.
|
|
410
|
+
if (!region || (migrationOn && regionOfCluster?.provider !== 'AWS')) {
|
|
386
411
|
const regionMessage = formElements.region.validationMessage ?? 'Please select a region';
|
|
387
412
|
setRegionValidation({
|
|
388
413
|
isValid: false,
|
|
@@ -428,6 +453,9 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
428
453
|
const success = await cta.create({
|
|
429
454
|
name: clusterName,
|
|
430
455
|
description: clusterDescription,
|
|
456
|
+
...(migrationOn && {
|
|
457
|
+
migration: { provider: 'aws', roleArn: roleArn.trim() },
|
|
458
|
+
}),
|
|
431
459
|
clusterPlanType: currentClusterPlanType,
|
|
432
460
|
clusterPlan,
|
|
433
461
|
channel: selectedChannel,
|
|
@@ -638,7 +666,27 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
638
666
|
autoFocus: true,
|
|
639
667
|
// A cluster name is not a personal detail, thus the
|
|
640
668
|
// browser must not offer the names from other forms.
|
|
641
|
-
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 }))] }) })] }),
|
|
669
|
+
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 }))] }) })] }), migration && migrationOffered && (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(Checkbox, { id: 'migrate-from-self-managed', labelText: migration.optionLabel, checked: migrationOn, disabled: isSubmitting() || noAvailableSlots, onChange: (event) => {
|
|
670
|
+
setMigrationChecked(event.target.checked);
|
|
671
|
+
setSubmitBlockedMessage(undefined);
|
|
672
|
+
// The migration supports AWS only.
|
|
673
|
+
if (event.target.checked) {
|
|
674
|
+
updateProvider('AWS');
|
|
675
|
+
}
|
|
676
|
+
// Check the typed name with the validator of the new mode, so
|
|
677
|
+
// that the limit shows before the submit.
|
|
678
|
+
const nameValidator = event.target.checked
|
|
679
|
+
? migration.nameValidation
|
|
680
|
+
: formElements.name.validation;
|
|
681
|
+
setClusterNameValidation(clusterName
|
|
682
|
+
? nameValidator(clusterName)
|
|
683
|
+
: { isValid: true, message: '' });
|
|
684
|
+
setRoleArnValidation({ isValid: true, message: '' });
|
|
685
|
+
} }) }), migrationOn && (_jsxs(_Fragment, { children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: migration.roleArnTitle }) }), _jsxs("div", { ref: roleArnFieldRef, style: { ...GRID_STYLE, maxWidth: '66.67%' }, children: [_jsx(Input, { type: 'text', id: 'migration-role-arn', "aria-label": migration.roleArnTitle, value: roleArn, placeholder: migration.roleArnPlaceholder, "aria-invalid": !roleArnValidation.isValid || undefined, disabled: isSubmitting() || noAvailableSlots, autoComplete: 'off', onChange: (event) => {
|
|
686
|
+
setRoleArnValidation({ isValid: true, message: '' });
|
|
687
|
+
setSubmitBlockedMessage(undefined);
|
|
688
|
+
setRoleArn(event.target.value);
|
|
689
|
+
} }), !roleArnValidation.isValid ? (_jsx("span", { className: 'mt-1 block text-xs text-danger-foreground-subtle', children: roleArnValidation.message })) : (_jsx("span", { className: 'mt-1 block text-xs', children: migration.roleArnHelp }))] })] }))] })), formElements.description && !migrationOn && (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.description.title }) }), _jsx("div", { style: { ...GRID_STYLE, maxWidth: '66.67%' }, children: _jsxs("div", { ref: clusterDescriptionInputFieldRef, 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) => {
|
|
642
690
|
setClusterDescriptionValidation({
|
|
643
691
|
isValid: true,
|
|
644
692
|
message: '',
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { CamundaClusterStageLabel } from '@camunda/camunda-composite-components';
|
|
2
2
|
import type { ClusterTtlOption } from '@camunda/ccma-shared-types';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
|
+
import type { MigrationIdentity } from '../../utils/migration-workaround.js';
|
|
4
5
|
export interface C4CreateClusterCtaParameters {
|
|
5
6
|
name: string;
|
|
6
7
|
description?: string;
|
|
8
|
+
/** Set when the customer migrates from Self-Managed. */
|
|
9
|
+
migration?: MigrationIdentity;
|
|
7
10
|
region: string;
|
|
8
11
|
backupRegion?: string;
|
|
9
12
|
clusterPlanType: string;
|
|
@@ -172,7 +175,24 @@ export interface C4CreateClusterDuplicate {
|
|
|
172
175
|
notice: string;
|
|
173
176
|
replace?: C4CreateClusterDuplicateReplace;
|
|
174
177
|
}
|
|
178
|
+
/** Shown only when the host gives it. The host owns the feature flag. */
|
|
179
|
+
export interface C4CreateClusterMigration {
|
|
180
|
+
optionLabel: string;
|
|
181
|
+
roleArnTitle: string;
|
|
182
|
+
roleArnPlaceholder: string;
|
|
183
|
+
roleArnHelp: string;
|
|
184
|
+
/** Replaces the name validation while the option is on. */
|
|
185
|
+
nameValidation: (value: string) => {
|
|
186
|
+
isValid: boolean;
|
|
187
|
+
message: string;
|
|
188
|
+
};
|
|
189
|
+
roleArnValidation: (value: string) => {
|
|
190
|
+
isValid: boolean;
|
|
191
|
+
message: string;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
175
194
|
export interface C4CreateClusterProps {
|
|
195
|
+
migration?: C4CreateClusterMigration;
|
|
176
196
|
loading?: boolean;
|
|
177
197
|
features?: {
|
|
178
198
|
identityIntegration?: boolean;
|
|
@@ -18,6 +18,23 @@
|
|
|
18
18
|
"maxLength": "Cluster Names can't be longer than 50 characters."
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
+
"migration": {
|
|
22
|
+
"option": "Migrate from Self-Managed",
|
|
23
|
+
"roleArn": {
|
|
24
|
+
"title": "IAM role ARN",
|
|
25
|
+
"placeholder": "arn:aws:iam::123456789012:role/role-name",
|
|
26
|
+
"help": "The AWS IAM role that Camunda uses to read your backup.",
|
|
27
|
+
"validation": {
|
|
28
|
+
"invalid": "Enter a valid AWS IAM role ARN, for example arn:aws:iam::123456789012:role/role-name.",
|
|
29
|
+
"maxLength": "The ARN can't be longer than 150 characters."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"name": {
|
|
33
|
+
"validation": {
|
|
34
|
+
"maxLength": "Cluster names can't be longer than 35 characters when you migrate."
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
21
38
|
"description": {
|
|
22
39
|
"title": "Description (optional)",
|
|
23
40
|
"placeholder": "Enter a description for the cluster",
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export type { C4ConvertTrialOrganizationModalProps } from './components/c4-conve
|
|
|
76
76
|
export { C4CreateAlertModal } from './components/c4-create-alert-modal/c4-create-alert-modal.js';
|
|
77
77
|
export type { C4CreateAlertModalHandle, C4CreateAlertModalProps, C4CreateAlertReportType, } from './components/c4-create-alert-modal/c4-create-alert-modal.types.js';
|
|
78
78
|
export { C4CreateCluster } from './components/c4-create-cluster/c4-create-cluster.js';
|
|
79
|
-
export type { C4CreateClusterChannelWithGenerations, C4CreateClusterClusterPlanType, C4CreateClusterCtaParameters, C4CreateClusterProps, C4CreateClusterRegion, C4CreateClusterTtlFormElement, C4CreateClusterTtlUnlimitedErrors, C4CreateClusterTtlUnlimitedInput, } from './components/c4-create-cluster/c4-create-cluster.types.js';
|
|
79
|
+
export type { C4CreateClusterChannelWithGenerations, C4CreateClusterClusterPlanType, C4CreateClusterCtaParameters, C4CreateClusterMigration, C4CreateClusterProps, C4CreateClusterRegion, C4CreateClusterTtlFormElement, C4CreateClusterTtlUnlimitedErrors, C4CreateClusterTtlUnlimitedInput, } from './components/c4-create-cluster/c4-create-cluster.types.js';
|
|
80
80
|
export { C4CreateClusterTtlSection, type C4CreateClusterTtlSectionProps, } from './components/c4-create-cluster/c4-create-cluster-ttl-section.js';
|
|
81
81
|
export { C4CreateClusterApiClientModal } from './components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js';
|
|
82
82
|
export type { C4CreateClusterApiClientModalHandle, C4CreateClusterApiClientModalOpenParams, C4CreateClusterApiClientModalProps, } from './components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.types.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
/** The flag of the "Migrate from Self-Managed" option of the create page. */
|
|
7
|
+
export const SELF_MANAGED_MIGRATION_FLAG = 'console.selfManagedMigration';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The cloud identity that the customer lets Camunda use for the transfer. */
|
|
2
|
+
export type MigrationIdentity = {
|
|
3
|
+
provider: 'aws';
|
|
4
|
+
roleArn: string;
|
|
5
|
+
};
|
|
6
|
+
export type MigrationState = 'awaitingTransfer' | 'migrating' | 'none';
|
|
7
|
+
export interface MigrationInfo {
|
|
8
|
+
state: MigrationState;
|
|
9
|
+
/** AWS only for now. Set when the state is not `none`. */
|
|
10
|
+
roleArn?: string;
|
|
11
|
+
/** The name without the prefix. */
|
|
12
|
+
displayName: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const getMigrationInfo: (cluster: {
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
}) => MigrationInfo;
|
|
18
|
+
export declare const buildStartName: (name: string) => string;
|
|
19
|
+
export declare const buildMigrateName: (name: string) => string;
|
|
20
|
+
/** The name limit while the prefix takes room in the 50 character name. */
|
|
21
|
+
export declare const MIGRATION_NAME_MAX_LENGTH = 35;
|
|
22
|
+
/** The description holds the role, and the description allows 150 characters. */
|
|
23
|
+
export declare const MIGRATION_ROLE_ARN_MAX_LENGTH = 150;
|
|
24
|
+
export declare const isValidAwsRoleArn: (value: string) => boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
// TODO(3844-workaround): The operator has no migration fields yet. The name
|
|
7
|
+
// prefix holds the state and the description holds the role. Delete this file
|
|
8
|
+
// when the operator spec is ready. Only this file knows the prefixes.
|
|
9
|
+
const START_PREFIX = '[3844 start] ';
|
|
10
|
+
const MIGRATE_PREFIX = '[3844 migrate] ';
|
|
11
|
+
export const getMigrationInfo = (cluster) => {
|
|
12
|
+
const prefixes = [
|
|
13
|
+
[START_PREFIX, 'awaitingTransfer'],
|
|
14
|
+
[MIGRATE_PREFIX, 'migrating'],
|
|
15
|
+
];
|
|
16
|
+
for (const [prefix, state] of prefixes) {
|
|
17
|
+
if (cluster.name.startsWith(prefix)) {
|
|
18
|
+
return {
|
|
19
|
+
state,
|
|
20
|
+
roleArn: cluster.description || undefined,
|
|
21
|
+
displayName: cluster.name.slice(prefix.length),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { state: 'none', displayName: cluster.name };
|
|
26
|
+
};
|
|
27
|
+
export const buildStartName = (name) => START_PREFIX + name;
|
|
28
|
+
export const buildMigrateName = (name) => MIGRATE_PREFIX + name;
|
|
29
|
+
/** The name limit while the prefix takes room in the 50 character name. */
|
|
30
|
+
export const MIGRATION_NAME_MAX_LENGTH = 35;
|
|
31
|
+
/** The description holds the role, and the description allows 150 characters. */
|
|
32
|
+
export const MIGRATION_ROLE_ARN_MAX_LENGTH = 150;
|
|
33
|
+
// The IAM path takes any printable character and ends with a slash. The role
|
|
34
|
+
// name after it takes no slash, so a trailing slash has no name and fails.
|
|
35
|
+
// AWS allows 64 characters at most in a role name.
|
|
36
|
+
const AWS_ROLE_ARN_PATTERN = /^arn:(?:aws|aws-cn|aws-us-gov):iam::\d{12}:role\/(?:[\x21-\x7E]+\/)?[A-Za-z0-9+=,.@_-]{1,64}$/;
|
|
37
|
+
export const isValidAwsRoleArn = (value) => value.length <= MIGRATION_ROLE_ARN_MAX_LENGTH &&
|
|
38
|
+
AWS_ROLE_ARN_PATTERN.test(value);
|
|
@@ -23,6 +23,13 @@ export declare function buildCreateClusterTranslations(t: ((key: string, options
|
|
|
23
23
|
namePlaceholder: string;
|
|
24
24
|
nameValidationRequired: string;
|
|
25
25
|
nameValidationMaxLength: string;
|
|
26
|
+
migrationOptionLabel: string;
|
|
27
|
+
migrationRoleArnTitle: string;
|
|
28
|
+
migrationRoleArnPlaceholder: string;
|
|
29
|
+
migrationRoleArnHelp: string;
|
|
30
|
+
migrationRoleArnInvalid: string;
|
|
31
|
+
migrationRoleArnMaxLength: string;
|
|
32
|
+
migrationNameMaxLength: string;
|
|
26
33
|
descriptionTitle: string;
|
|
27
34
|
descriptionPlaceholder: string;
|
|
28
35
|
descriptionValidationMaxLength: string;
|
|
@@ -14,9 +14,11 @@ import { getC4CreateClusterExternalLinks, getC4TalkToAnExpertUrl, } from '../../
|
|
|
14
14
|
import { addC4ConsoleNotification } from '../../notifications/c4-console-notifications-handle.js';
|
|
15
15
|
import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
16
16
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
17
|
-
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
17
|
+
import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
|
|
18
|
+
import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
|
|
18
19
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
19
20
|
import { Link, Stack } from '../../ui/index.js';
|
|
21
|
+
import { buildStartName, isValidAwsRoleArn, MIGRATION_NAME_MAX_LENGTH, MIGRATION_ROLE_ARN_MAX_LENGTH, } from '../../utils/migration-workaround.js';
|
|
20
22
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
21
23
|
/**
|
|
22
24
|
* What the customer types to confirm the delete of the source cluster. It
|
|
@@ -296,6 +298,13 @@ export function buildCreateClusterTranslations(t) {
|
|
|
296
298
|
namePlaceholder: translate('createcluster:form.name.placeholder', 'Enter a name for the cluster'),
|
|
297
299
|
nameValidationRequired: translate('createcluster:form.name.validation.required', 'Please enter a name for the cluster'),
|
|
298
300
|
nameValidationMaxLength: translate('createcluster:form.name.validation.maxLength', "Cluster Names can't be longer than 50 characters."),
|
|
301
|
+
migrationOptionLabel: translate('createcluster:form.migration.option', 'Migrate from Self-Managed'),
|
|
302
|
+
migrationRoleArnTitle: translate('createcluster:form.migration.roleArn.title', 'IAM role ARN'),
|
|
303
|
+
migrationRoleArnPlaceholder: translate('createcluster:form.migration.roleArn.placeholder', 'arn:aws:iam::123456789012:role/role-name'),
|
|
304
|
+
migrationRoleArnHelp: translate('createcluster:form.migration.roleArn.help', 'The AWS IAM role that Camunda uses to read your backup.'),
|
|
305
|
+
migrationRoleArnInvalid: translate('createcluster:form.migration.roleArn.validation.invalid', 'Enter a valid AWS IAM role ARN, for example arn:aws:iam::123456789012:role/role-name.'),
|
|
306
|
+
migrationRoleArnMaxLength: translate('createcluster:form.migration.roleArn.validation.maxLength', "The ARN can't be longer than 150 characters."),
|
|
307
|
+
migrationNameMaxLength: translate('createcluster:form.migration.name.validation.maxLength', "Cluster names can't be longer than 35 characters when you migrate."),
|
|
299
308
|
descriptionTitle: translate('createcluster:form.description.title', 'Description (optional)'),
|
|
300
309
|
descriptionPlaceholder: translate('createcluster:form.description.placeholder', 'Enter a description for the cluster'),
|
|
301
310
|
descriptionValidationMaxLength: translate('createcluster:form.description.validation.maxLength', 'Description cannot be longer than 150 characters.'),
|
|
@@ -521,6 +530,10 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
521
530
|
}, [organizationToSalesPlan]);
|
|
522
531
|
const alphaAsDefault = salesPlanTypeRaw === SalesPlanType.TRIAL;
|
|
523
532
|
const advancedOfferingVisible = salesPlanTypeRaw === SalesPlanType.ENTERPRISE;
|
|
533
|
+
const migrationFlagOn = useC4FeatureFlag(SELF_MANAGED_MIGRATION_FLAG);
|
|
534
|
+
const migrationAvailable = migrationFlagOn &&
|
|
535
|
+
salesPlanTypeRaw === SalesPlanType.ENTERPRISE &&
|
|
536
|
+
!sourceClusterId;
|
|
524
537
|
const displayedSalesPlan = useMemo(() => {
|
|
525
538
|
const trialStateExpired = getBoolean(organizationToSalesPlan, 'trialStateExpired') ?? false;
|
|
526
539
|
if (!salesPlanTypeRaw) {
|
|
@@ -926,8 +939,11 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
926
939
|
}), [translations]);
|
|
927
940
|
const create = useCallback(async (params) => {
|
|
928
941
|
selectedEncryptionRef.current = params.encryption;
|
|
942
|
+
// TODO(3844-workaround): the name prefix and the description carry
|
|
943
|
+
// the migration until the operator has migration fields.
|
|
944
|
+
const migration = migrationAvailable ? params.migration : undefined;
|
|
929
945
|
const body = {
|
|
930
|
-
name: params.name,
|
|
946
|
+
name: migration ? buildStartName(params.name) : params.name,
|
|
931
947
|
planTypeId: params.clusterPlanType,
|
|
932
948
|
...(params.clusterPlan && { clusterPlanId: params.clusterPlan }),
|
|
933
949
|
channelId: params.channel,
|
|
@@ -940,7 +956,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
940
956
|
numberOfAllocatedHwPackages: params.numberOfAllocatedHwPackages,
|
|
941
957
|
tasklistV2Enabled: params.tasklistV2Enabled,
|
|
942
958
|
identityBackendChecksEnabled: params.identityBackendChecksEnabled,
|
|
943
|
-
description: params.description,
|
|
959
|
+
description: migration ? migration.roleArn : params.description,
|
|
944
960
|
...(clusterTtlEnabled &&
|
|
945
961
|
params.ttl && {
|
|
946
962
|
ttl: params.ttl,
|
|
@@ -998,6 +1014,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
998
1014
|
apiConfig,
|
|
999
1015
|
carryOverStepLabels,
|
|
1000
1016
|
clusterTtlEnabled,
|
|
1017
|
+
migrationAvailable,
|
|
1001
1018
|
orgId,
|
|
1002
1019
|
replaceSource,
|
|
1003
1020
|
runtime.telemetry,
|
|
@@ -1033,6 +1050,43 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1033
1050
|
const createClusterProps = useMemo(() => {
|
|
1034
1051
|
return {
|
|
1035
1052
|
loading,
|
|
1053
|
+
...(migrationAvailable && {
|
|
1054
|
+
migration: {
|
|
1055
|
+
optionLabel: translations.migrationOptionLabel,
|
|
1056
|
+
roleArnTitle: translations.migrationRoleArnTitle,
|
|
1057
|
+
roleArnPlaceholder: translations.migrationRoleArnPlaceholder,
|
|
1058
|
+
roleArnHelp: translations.migrationRoleArnHelp,
|
|
1059
|
+
nameValidation: (value) => {
|
|
1060
|
+
if (!value) {
|
|
1061
|
+
return {
|
|
1062
|
+
isValid: false,
|
|
1063
|
+
message: translations.nameValidationRequired,
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
if (value.length > MIGRATION_NAME_MAX_LENGTH) {
|
|
1067
|
+
return {
|
|
1068
|
+
isValid: false,
|
|
1069
|
+
message: translations.migrationNameMaxLength,
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
return { isValid: true, message: '' };
|
|
1073
|
+
},
|
|
1074
|
+
roleArnValidation: (value) => {
|
|
1075
|
+
if (value.length > MIGRATION_ROLE_ARN_MAX_LENGTH) {
|
|
1076
|
+
return {
|
|
1077
|
+
isValid: false,
|
|
1078
|
+
message: translations.migrationRoleArnMaxLength,
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
return isValidAwsRoleArn(value)
|
|
1082
|
+
? { isValid: true, message: '' }
|
|
1083
|
+
: {
|
|
1084
|
+
isValid: false,
|
|
1085
|
+
message: translations.migrationRoleArnInvalid,
|
|
1086
|
+
};
|
|
1087
|
+
},
|
|
1088
|
+
},
|
|
1089
|
+
}),
|
|
1036
1090
|
banner: {
|
|
1037
1091
|
noSlotsLeft: {
|
|
1038
1092
|
title: translations.bannerNoSlotsLeftTitle,
|
|
@@ -1226,6 +1280,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1226
1280
|
duplicate,
|
|
1227
1281
|
dualRegionBackups,
|
|
1228
1282
|
displayedSalesPlan,
|
|
1283
|
+
migrationAvailable,
|
|
1229
1284
|
resolvedTalkToAnExpertUrl,
|
|
1230
1285
|
runtime.telemetry,
|
|
1231
1286
|
orgId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"react-markdown": "^8.0.7 || ^10.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@camunda/ccma-api": "6.
|
|
89
|
-
"@camunda/ccma-shared-types": "11.
|
|
88
|
+
"@camunda/ccma-api": "6.6.0",
|
|
89
|
+
"@camunda/ccma-shared-types": "11.2.0",
|
|
90
90
|
"@pactsafe/pactsafe-react-sdk": "2.15.0",
|
|
91
91
|
"cron-parser": "5.10.2",
|
|
92
92
|
"mobx": "6.16.1",
|