@camunda/ccma-saas-frontend 0.22.16 → 0.24.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.
@@ -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
- if (!region) {
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 }))] }) })] }), formElements.description && (_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) => {
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;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /*
3
3
  * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
4
4
  * under one or more contributor license agreements. Licensed under a commercial license.
@@ -6,11 +6,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  */
7
7
  import { TRIAL_EXTENSION_SURVEY_QUESTIONS, } from '@camunda/ccma-shared-types';
8
8
  import { useState } from 'react';
9
- import { Checkbox, Loading, Modal, Stack, TextArea } from '../../ui/index.js';
9
+ import { C4_EXTERNAL_URLS } from '../../externalUrls.const.js';
10
+ import { Checkbox, Link, Loading, Modal, Stack, TextArea } from '../../ui/index.js';
10
11
  import { RadioButton, RadioButtonGroup } from '../../ui/families.js';
11
12
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
12
13
  export const C4ExtendTrialModal = ({ isOpen, onClose, onSubmit, isSubmitting, error, }) => {
13
14
  const [answers, setAnswers] = useState({});
15
+ const [researchConsent, setResearchConsent] = useState(false);
14
16
  const setSingleAnswer = (questionId, value) => {
15
17
  setAnswers((prev) => ({ ...prev, [questionId]: value }));
16
18
  };
@@ -36,7 +38,7 @@ export const C4ExtendTrialModal = ({ isOpen, onClose, onSubmit, isSubmitting, er
36
38
  answer: answers[q.id] ?? (q.type === 'multiselect' ? [] : ''),
37
39
  }));
38
40
  return (_jsx(Modal, { open: isOpen, modalHeading: 'Extend your trial', primaryButtonText: 'Extend trial', secondaryButtonText: 'Cancel', primaryButtonDisabled: !canSubmit, onRequestClose: onClose, onSecondarySubmit: onClose, onRequestSubmit: () => {
39
- void onSubmit(buildAnswers());
41
+ void onSubmit(buildAnswers(), researchConsent);
40
42
  }, children: isSubmitting ? (_jsxs(Stack, { gap: 4, children: [_jsx(Loading, { small: true, withOverlay: false }), _jsx("p", { children: "Reviewing your extension request\u2026" })] })) : (_jsxs(Stack, { gap: 6, children: [error !== undefined && (_jsx(C4InlineNotification, { kind: 'error', title: 'Extension failed.', subtitle: error, hideCloseButton: true })), TRIAL_EXTENSION_SURVEY_QUESTIONS.map((question) => {
41
43
  if (question.type === 'select' && question.options) {
42
44
  return (_jsxs(Stack, { gap: 2, children: [_jsx("p", { children: question.question }), _jsx(RadioButtonGroup, { name: `extend-trial-q-${question.id}`, "aria-label": question.question, valueSelected: answers[question.id] ?? '', onChange: (value) => setSingleAnswer(question.id, String(value ?? '')), children: question.options.map((opt) => (_jsx(RadioButton, { id: `extend-trial-q-${question.id}-${opt.replace(/\s+/g, '-')}`, labelText: opt, value: opt }, opt))) })] }, question.id));
@@ -46,5 +48,5 @@ export const C4ExtendTrialModal = ({ isOpen, onClose, onSubmit, isSubmitting, er
46
48
  return (_jsxs(Stack, { gap: 2, children: [_jsxs("p", { children: [question.question, question.required && _jsx("span", { "aria-hidden": 'true', children: " *" })] }), question.options.map((opt) => (_jsx(Checkbox, { id: `extend-trial-q-${question.id}-${opt.replace(/\s+/g, '-')}`, labelText: opt, checked: selected.includes(opt), onChange: () => toggleMultiAnswer(question.id, opt) }, opt)))] }, question.id));
47
49
  }
48
50
  return (_jsx(TextArea, { id: `extend-trial-q-${question.id}`, labelText: question.question, value: answers[question.id] ?? '', onChange: (e) => setSingleAnswer(question.id, e.target.value) }, question.id));
49
- })] })) }));
51
+ }), _jsx(Checkbox, { id: 'extend-trial-research-consent', labelText: _jsxs(_Fragment, { children: ["I agree that Camunda may contact me by email about opportunities to participate in user research. I understand that participation is voluntary and that I can withdraw my consent at any time by contacting", ' ', _jsx(Link, { href: `mailto:${C4_EXTERNAL_URLS.help.researchEmail}`, children: C4_EXTERNAL_URLS.help.researchEmail }), "."] }), checked: researchConsent, onChange: (_event, { checked }) => setResearchConsent(checked) })] })) }));
50
52
  };
@@ -2,7 +2,7 @@ import type { TrialExtensionSurveyAnswer } from '@camunda/ccma-shared-types';
2
2
  export interface C4ExtendTrialModalProps {
3
3
  isOpen: boolean;
4
4
  onClose: () => void;
5
- onSubmit: (answers: TrialExtensionSurveyAnswer[]) => Promise<void>;
5
+ onSubmit: (answers: TrialExtensionSurveyAnswer[], researchConsent: boolean) => Promise<void>;
6
6
  isSubmitting: boolean;
7
7
  error?: string;
8
8
  }
@@ -65,6 +65,7 @@ export declare const C4_EXTERNAL_URLS: {
65
65
  readonly requestCelpLicence: "https://camunda.com/educationee/";
66
66
  readonly deleteAccountTechnicalSupport: "https://jira.camunda.com/";
67
67
  readonly deleteAccountCustomerSuccessEmail: "customer-success@camunda.com";
68
+ readonly researchEmail: "research@camunda.com";
68
69
  };
69
70
  };
70
71
  export declare function getC4TalkToAnExpertUrl(properties?: {
@@ -66,6 +66,8 @@ export const C4_EXTERNAL_URLS = {
66
66
  // owner, who must contact support instead of self-deleting.
67
67
  deleteAccountTechnicalSupport: 'https://jira.camunda.com/',
68
68
  deleteAccountCustomerSuccessEmail: 'customer-success@camunda.com',
69
+ // A user withdraws the research consent of the extend-trial modal here.
70
+ researchEmail: 'research@camunda.com',
69
71
  },
70
72
  };
71
73
  export function getC4TalkToAnExpertUrl(properties) {
@@ -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",
@@ -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,2 @@
1
+ /** The flag of the "Migrate from Self-Managed" option of the create page. */
2
+ export declare const SELF_MANAGED_MIGRATION_FLAG = "console.selfManagedMigration";
@@ -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,
@@ -2,7 +2,7 @@ import type { TrialExtensionSurveyAnswer } from '@camunda/ccma-shared-types';
2
2
  export declare function useExtendTrial(orgId: string, opts: {
3
3
  onSuccess?: () => void;
4
4
  }): {
5
- submit: (answers: TrialExtensionSurveyAnswer[]) => Promise<void>;
5
+ submit: (answers: TrialExtensionSurveyAnswer[], researchConsent?: boolean) => Promise<void>;
6
6
  isSubmitting: boolean;
7
7
  error: string | undefined;
8
8
  };
@@ -13,14 +13,14 @@ export function useExtendTrial(orgId, opts) {
13
13
  const data = useC4ConsoleData();
14
14
  const [isSubmitting, setIsSubmitting] = useState(false);
15
15
  const [error, setError] = useState(undefined);
16
- const submit = async (answers) => {
16
+ const submit = async (answers, researchConsent) => {
17
17
  setIsSubmitting(true);
18
18
  setError(undefined);
19
19
  try {
20
20
  await new Promise((resolve) => setTimeout(resolve, 5000 + Math.random() * 10000));
21
21
  await OrgsService.selfExtendTrial({
22
22
  config: toApiConfig(runtime),
23
- params: { orgId, surveyAnswers: answers },
23
+ params: { orgId, surveyAnswers: answers, researchConsent },
24
24
  });
25
25
  data.invalidateAll(orgId);
26
26
  opts.onSuccess?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.22.16",
3
+ "version": "0.24.0",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -85,7 +85,7 @@
85
85
  "react-markdown": "^8.0.7 || ^10.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@camunda/ccma-api": "6.6.0",
88
+ "@camunda/ccma-api": "6.7.0",
89
89
  "@camunda/ccma-shared-types": "11.2.0",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",