@camunda/ccma-saas-frontend 0.28.0 → 0.28.1

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.
@@ -54,6 +54,7 @@ const SummaryMobileWrapper = styled.div `
54
54
  display: none;
55
55
  }
56
56
  `;
57
+ const MIGRATION_NOTE_ID = 'migration-option-note';
57
58
  const GRID_STYLE = { paddingInline: '1rem' };
58
59
  const FieldLabel = (props) => (_jsx("span", { style: {
59
60
  display: 'block',
@@ -772,6 +773,46 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
772
773
  disabled: free <= index,
773
774
  })), 4, _jsxs(_Fragment, { children: [_jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: sizes.description }) }), _jsx("div", { style: GRID_STYLE, children: _jsx(Meter, { label: sizes.bold, value: used, max: Math.max(total, used, 1), valueFormatter: () => copy('hardwarePackages.reservationsUsed', { used, total }) }) }), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: _jsx(C4ExternalLink, { id: 'allocatedHardwarePackages-docs', inline: true, label: sizes.link.label, href: sizes.link.href }) }) })] }));
774
775
  };
776
+ // The migration restores the cluster from an external backup, thus it sits
777
+ // in the Backup and recovery section.
778
+ const renderMigrationSection = () => {
779
+ if (!migration || !migrationOffered)
780
+ return undefined;
781
+ // Texts for a ticked option that a Camundi cannot see at the form fields.
782
+ const migrationNote = [];
783
+ if (migrationOn && !region) {
784
+ migrationNote.push({ text: migration.regionHint, className: '' });
785
+ }
786
+ if (migrationOn &&
787
+ clusterName &&
788
+ !migration.nameValidation(clusterName).isValid) {
789
+ migrationNote.push({
790
+ text: migration.nameValidation(clusterName).message,
791
+ className: 'text-danger-foreground-subtle',
792
+ });
793
+ }
794
+ return (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: migration.sectionTitle }) }), _jsxs("div", { style: GRID_STYLE, children: [_jsx(Checkbox, { id: 'migrate-from-self-managed', labelText: migration.optionLabel, checked: migrationOn, "aria-describedby": MIGRATION_NOTE_ID, disabled: isSubmitting() || noAvailableSlots, onChange: (event) => {
795
+ setMigrationChecked(event.target.checked);
796
+ setSubmitBlockedMessage(undefined);
797
+ // The migration supports AWS only.
798
+ if (event.target.checked) {
799
+ updateProvider('AWS');
800
+ }
801
+ // Check the typed name with the validator of the new mode, so
802
+ // that the limit shows before the submit.
803
+ const nameValidator = event.target.checked
804
+ ? migration.nameValidation
805
+ : formElements.name.validation;
806
+ setClusterNameValidation(clusterName
807
+ ? nameValidator(clusterName)
808
+ : { isValid: true, message: '' });
809
+ setRoleArnValidation({ isValid: true, message: '' });
810
+ } }), _jsx("div", { id: MIGRATION_NOTE_ID, role: 'status', className: migrationNote.length > 0 ? 'mt-1' : undefined, children: migrationNote.map((note) => (_jsx("span", { className: `block text-xs ${note.className}`, children: note.text }, note.text))) })] }), 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) => {
811
+ setRoleArnValidation({ isValid: true, message: '' });
812
+ setSubmitBlockedMessage(undefined);
813
+ setRoleArn(event.target.value);
814
+ } }), !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 }))] })] }))] }));
815
+ };
775
816
  const renderBackupSection = () => {
776
817
  const regionTitle = selectedRegion?.title ?? copy('backup.regionFallback');
777
818
  const pairs = plainPairsOf(selectedRegion);
@@ -856,7 +897,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
856
897
  choiceGroup(copy('backup.secondRegion.title'), backupRegion ?? '', setBackupRegion, pairCards(pairs, (label) => copy('backup.secondRegion.description', {
857
898
  region: regionTitle,
858
899
  secondRegion: label,
859
- })))] }))] }))] }));
900
+ })))] }))] })), renderMigrationSection()] }));
860
901
  };
861
902
  const renderContent = () => {
862
903
  if (loading) {
@@ -875,27 +916,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
875
916
  autoFocus: true,
876
917
  // A cluster name is not a personal detail, thus the
877
918
  // browser must not offer the names from other forms.
878
- 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) => {
879
- setMigrationChecked(event.target.checked);
880
- setSubmitBlockedMessage(undefined);
881
- // The migration supports AWS only.
882
- if (event.target.checked) {
883
- updateProvider('AWS');
884
- }
885
- // Check the typed name with the validator of the new mode, so
886
- // that the limit shows before the submit.
887
- const nameValidator = event.target.checked
888
- ? migration.nameValidation
889
- : formElements.name.validation;
890
- setClusterNameValidation(clusterName
891
- ? nameValidator(clusterName)
892
- : { isValid: true, message: '' });
893
- setRoleArnValidation({ isValid: true, message: '' });
894
- } }) }), 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) => {
895
- setRoleArnValidation({ isValid: true, message: '' });
896
- setSubmitBlockedMessage(undefined);
897
- setRoleArn(event.target.value);
898
- } }), !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) => {
919
+ 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 && !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) => {
899
920
  setClusterDescriptionValidation({
900
921
  isValid: true,
901
922
  message: '',
@@ -940,7 +961,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
940
961
  title: formElements.clusterPlan.defaultLabel,
941
962
  },
942
963
  ...formElements.clusterPlan.options,
943
- ].map((option) => (_jsx(RadioButton, { id: `clusterPlan-${option.uuid}`, labelText: option.title, value: option.uuid }, option.uuid))) }) }), _jsx("p", { style: { marginLeft: '1rem' }, children: formElements.clusterPlan.description })] })), renderSizeSection(), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), formElements.region.dualRegionBackups && (_jsxs(_Fragment, { children: [renderBackupSection(), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) })] })), _jsx("div", { style: GRID_STYLE, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style: { marginBottom: '0.5rem' }, children: _jsx(C4SegmentedControl, { options: formElements.generation.channels.map((channel) => ({
964
+ ].map((option) => (_jsx(RadioButton, { id: `clusterPlan-${option.uuid}`, labelText: option.title, value: option.uuid }, option.uuid))) }) }), _jsx("p", { style: { marginLeft: '1rem' }, children: formElements.clusterPlan.description })] })), renderSizeSection(), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), formElements.region.dualRegionBackups ? (_jsxs(_Fragment, { children: [renderBackupSection(), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) })] })) : (migrationOffered && (_jsxs(_Fragment, { children: [_jsxs(Stack, { gap: 4, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: copy('backup.title') }) }), renderMigrationSection()] }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) })] }))), _jsx("div", { style: GRID_STYLE, children: _jsxs(Stack, { gap: 2, children: [_jsx(FormElementTitle, { title: formElements.generation.title }), _jsx("div", { style: { marginBottom: '0.5rem' }, children: _jsx(C4SegmentedControl, { options: formElements.generation.channels.map((channel) => ({
944
965
  id: channel.uuid,
945
966
  label: channel.title,
946
967
  disabled: noAvailableSlots || channel.isEmpty,
@@ -178,10 +178,14 @@ export interface C4CreateClusterDuplicate {
178
178
  }
179
179
  /** Shown only when the host gives it. The host owns the feature flag. */
180
180
  export interface C4CreateClusterMigration {
181
+ /** The heading of the migration part of the Backup and recovery section. */
182
+ sectionTitle: string;
181
183
  optionLabel: string;
182
184
  roleArnTitle: string;
183
185
  roleArnPlaceholder: string;
184
186
  roleArnHelp: string;
187
+ /** Shown while the option is on and no AWS region is selected. */
188
+ regionHint: string;
185
189
  /** Replaces the name validation while the option is on. */
186
190
  nameValidation: (value: string) => {
187
191
  isValid: boolean;
@@ -19,7 +19,9 @@
19
19
  }
20
20
  },
21
21
  "migration": {
22
+ "sectionTitle": "Restore from an external backup",
22
23
  "option": "Migrate from Self-Managed",
24
+ "regionHint": "Select an AWS region above.",
23
25
  "roleArn": {
24
26
  "title": "IAM role ARN",
25
27
  "placeholder": "arn:aws:iam::123456789012:role/role-name",
@@ -23,12 +23,14 @@ export declare function buildCreateClusterTranslations(t: ((key: string, options
23
23
  namePlaceholder: string;
24
24
  nameValidationRequired: string;
25
25
  nameValidationMaxLength: string;
26
+ migrationSectionTitle: string;
26
27
  migrationOptionLabel: string;
27
28
  migrationRoleArnTitle: string;
28
29
  migrationRoleArnPlaceholder: string;
29
30
  migrationRoleArnHelp: string;
30
31
  migrationRoleArnInvalid: string;
31
32
  migrationRoleArnMaxLength: string;
33
+ migrationRegionHint: string;
32
34
  migrationNameMaxLength: string;
33
35
  descriptionTitle: string;
34
36
  descriptionPlaceholder: string;
@@ -298,12 +298,14 @@ export function buildCreateClusterTranslations(t) {
298
298
  namePlaceholder: translate('createcluster:form.name.placeholder', 'Enter a name for the cluster'),
299
299
  nameValidationRequired: translate('createcluster:form.name.validation.required', 'Please enter a name for the cluster'),
300
300
  nameValidationMaxLength: translate('createcluster:form.name.validation.maxLength', "Cluster Names can't be longer than 50 characters."),
301
+ migrationSectionTitle: translate('createcluster:form.migration.sectionTitle', 'Restore from an external backup'),
301
302
  migrationOptionLabel: translate('createcluster:form.migration.option', 'Migrate from Self-Managed'),
302
303
  migrationRoleArnTitle: translate('createcluster:form.migration.roleArn.title', 'IAM role ARN'),
303
304
  migrationRoleArnPlaceholder: translate('createcluster:form.migration.roleArn.placeholder', 'arn:aws:iam::123456789012:role/role-name'),
304
305
  migrationRoleArnHelp: translate('createcluster:form.migration.roleArn.help', 'The AWS IAM role that Camunda uses to read your backup.'),
305
306
  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
307
  migrationRoleArnMaxLength: translate('createcluster:form.migration.roleArn.validation.maxLength', "The ARN can't be longer than 150 characters."),
308
+ migrationRegionHint: translate('createcluster:form.migration.regionHint', 'Select an AWS region above.'),
307
309
  migrationNameMaxLength: translate('createcluster:form.migration.name.validation.maxLength', "Cluster names can't be longer than 35 characters when you migrate."),
308
310
  descriptionTitle: translate('createcluster:form.description.title', 'Description (optional)'),
309
311
  descriptionPlaceholder: translate('createcluster:form.description.placeholder', 'Enter a description for the cluster'),
@@ -1052,10 +1054,12 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
1052
1054
  loading,
1053
1055
  ...(migrationAvailable && {
1054
1056
  migration: {
1057
+ sectionTitle: translations.migrationSectionTitle,
1055
1058
  optionLabel: translations.migrationOptionLabel,
1056
1059
  roleArnTitle: translations.migrationRoleArnTitle,
1057
1060
  roleArnPlaceholder: translations.migrationRoleArnPlaceholder,
1058
1061
  roleArnHelp: translations.migrationRoleArnHelp,
1062
+ regionHint: translations.migrationRegionHint,
1059
1063
  nameValidation: (value) => {
1060
1064
  if (!value) {
1061
1065
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"