@camunda/ccma-saas-frontend 0.24.0 → 0.25.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.js +283 -105
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.mocks.js +4 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +8 -1
- package/lib/esm/i18n/en/pages/createcluster.json +66 -3
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +3 -1
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { AUTHORIZATION_TOGGLE_MIN_VERSION, ClusterPlanTypeCategory, checkVersion, LINE_8_10_MIN_VERSION, TASKLIST_MODE_TOGGLE_MIN_VERSION, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
3
|
-
import { ChoiceCard, ChoiceCardGroup, Input, Textarea, } from '@camunda/design-system';
|
|
4
|
-
import { Check, ChevronDown, ChevronUp, CircleAlert, Code, Database, } from 'lucide-react';
|
|
5
|
-
import { useRef, useState, } from 'react';
|
|
3
|
+
import { Alert, ChoiceCard, ChoiceCardGroup, Input, Meter, Textarea, } from '@camunda/design-system';
|
|
4
|
+
import { Archive, Check, ChevronDown, ChevronUp, CircleAlert, Code, Copy, Database, LifeBuoy, } from 'lucide-react';
|
|
5
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
|
-
import
|
|
7
|
+
import createcluster from '../../i18n/en/pages/createcluster.json';
|
|
8
|
+
import { Button, TextInput as C4TextInput, Checkbox, ClusterTag, DsBadge, DsText, Link, Modal, SkeletonText, Stack, Tile, } from '../../ui/index.js';
|
|
8
9
|
import { RadioButton, RadioButtonGroup } from '../../ui/families.js';
|
|
10
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
9
11
|
import { SECTION_HEADING_STYLE } from '../../utils/section-heading-style.js';
|
|
10
12
|
import { SpinningLoader } from '../c4-cluster-overview/ds-status-icon-text.js';
|
|
11
13
|
import { C4ClusterTagSelector } from '../c4-cluster-tag-selector/c4-cluster-tag-selector.js';
|
|
@@ -96,7 +98,59 @@ const enableMap = {
|
|
|
96
98
|
};
|
|
97
99
|
// The radio value of "no unlocked plan". A plan uuid never has this value.
|
|
98
100
|
const PLAN_TYPE_DEFAULT = 'default';
|
|
101
|
+
/** A backup with more than one region keeps a copy in a second region. */
|
|
102
|
+
const isDual = (backup) => (backup?.regions.length ?? 0) > 1;
|
|
103
|
+
/** The dual region pairs of a region. With `cold`, only the failover pairs. */
|
|
104
|
+
const pairsOf = (region, cold = false) => region?.backups.filter((backup) => isDual(backup) && (!cold || backup.failover === true)) ?? [];
|
|
105
|
+
/** The pairs that cold recovery "No" may pick: the non-failover pairs. */
|
|
106
|
+
const plainPairsOf = (region) => pairsOf(region).filter((pair) => pair.failover !== true);
|
|
107
|
+
/** Only failover pairs force cold recovery, as "No" then has no backup. */
|
|
108
|
+
const needsColdRecovery = (region) => pairsOf(region, true).length > 0 &&
|
|
109
|
+
plainPairsOf(region).length === 0 &&
|
|
110
|
+
!region?.backups.some((item) => !isDual(item));
|
|
111
|
+
/** The regions of a pair other than the region of the cluster. */
|
|
112
|
+
const secondRegionOf = (region, backup) => {
|
|
113
|
+
// The primary region is in every backup of the region.
|
|
114
|
+
const shared = (region?.backups ?? [])
|
|
115
|
+
.map((item) => item.regions.map((r) => r.id))
|
|
116
|
+
.reduce((ids, next) => (ids ? ids.filter((id) => next.includes(id)) : next), undefined);
|
|
117
|
+
// With no single id, the id that is named like the region is the primary.
|
|
118
|
+
const named = (region?.backups ?? [])
|
|
119
|
+
.flatMap((item) => item.regions)
|
|
120
|
+
.find((item) => shared?.includes(item.id) && item.label === region?.title);
|
|
121
|
+
const primary = shared?.length === 1
|
|
122
|
+
? shared[0]
|
|
123
|
+
: (named?.id ??
|
|
124
|
+
region?.backups.find((item) => !isDual(item))?.regions[0]?.id ??
|
|
125
|
+
backup?.regions[0]?.id);
|
|
126
|
+
return (backup?.regions ?? [])
|
|
127
|
+
.filter((item) => item.id !== primary)
|
|
128
|
+
.map((item) => item.label)
|
|
129
|
+
.join(', ');
|
|
130
|
+
};
|
|
131
|
+
/** Only an advanced offering with an availability class has a size choice. */
|
|
132
|
+
const hasSizeChoice = (planType) => planType?.category === ClusterPlanTypeCategory.ADVANCED_OFFERING &&
|
|
133
|
+
planType.availabilityClass !== undefined &&
|
|
134
|
+
planType.availabilityClass !== 'unset';
|
|
135
|
+
/** The largest size up to `size` that the free reservations allow, at least 1. */
|
|
136
|
+
const fitSize = (planType, size) => hasSizeChoice(planType)
|
|
137
|
+
? Math.max(1, Math.min(size, planType?.available ?? 0))
|
|
138
|
+
: size;
|
|
139
|
+
/**
|
|
140
|
+
* The text of a key under `createcluster:form`. The English bundle is the
|
|
141
|
+
* fallback when the host gives no `t`. `count` selects the plural form.
|
|
142
|
+
*/
|
|
143
|
+
const translate = (t, name, values = {}) => {
|
|
144
|
+
const find = (key) => key
|
|
145
|
+
.split('.')
|
|
146
|
+
.reduce((node, part) => node?.[part], createcluster.form);
|
|
147
|
+
const english = String(find(name) ??
|
|
148
|
+
find(`${name}_${values.count === 1 ? 'one' : 'other'}`) ??
|
|
149
|
+
name);
|
|
150
|
+
return safeTranslate(t, `createcluster:form.${name}`, english.replace(/\{\{(\w+)\}\}/g, (_, key) => String(values[key])), values);
|
|
151
|
+
};
|
|
99
152
|
export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, tasklistModeToggle, authorizationToggle, banner: { noSlotsLeft }, initialValues, duplicate, migration, }) => {
|
|
153
|
+
const copy = (name, values) => translate(formElements.t, name, values);
|
|
100
154
|
const preConditions = formElements.clusterPlanType.options.length > 0 &&
|
|
101
155
|
formElements.region.options.length > 0 &&
|
|
102
156
|
formElements.generation.channels.length > 0 &&
|
|
@@ -181,7 +235,9 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
181
235
|
// depends on cluster type
|
|
182
236
|
const [authorizationEnabled, setAuthorizationEnabled] = useState(initialValues?.identityBackendChecksEnabled ??
|
|
183
237
|
selectedPlan?.type !== 'prod');
|
|
184
|
-
|
|
238
|
+
// A copy can need more reservations than the org has left. Then it starts
|
|
239
|
+
// on the largest size that fits.
|
|
240
|
+
const [numberOfAllocatedHwPackages, setNumberOfAllocatedHwPackages] = useState(fitSize(defaultClusterPlanType, initialValues?.numberOfAllocatedHwPackages ?? 1));
|
|
185
241
|
const [clusterPlan, setClusterPlan] = useState(formElements.clusterPlan?.options.find((option) => option.uuid === initialValues?.clusterPlan)?.uuid);
|
|
186
242
|
const initialRegion = formElements.region.options.find((option) => option.uuid === initialValues?.region);
|
|
187
243
|
const defaultProvider = initialRegion?.provider ??
|
|
@@ -216,11 +272,25 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
216
272
|
return undefined;
|
|
217
273
|
return formElements.region.dualRegionBackups
|
|
218
274
|
? (selectedRegion.backups.find((backup) => backup.regions.length === 1)
|
|
219
|
-
?.uuid ??
|
|
275
|
+
?.uuid ??
|
|
276
|
+
plainPairsOf(selectedRegion)[0]?.uuid ??
|
|
277
|
+
pairsOf(selectedRegion, true)[0]?.uuid ??
|
|
278
|
+
'')
|
|
220
279
|
: undefined;
|
|
221
280
|
};
|
|
222
|
-
|
|
223
|
-
|
|
281
|
+
// A copy keeps the backup pair of its source only on a plan with dual
|
|
282
|
+
// region. Else the form sends a pair that it does not show.
|
|
283
|
+
const initialBackup = formElements.region.dualRegionBackups
|
|
284
|
+
? initialRegion?.backups.find((backup) => backup.uuid === initialValues?.backupRegion)
|
|
285
|
+
: undefined;
|
|
286
|
+
const [backupRegion, setBackupRegion] = useState(initialBackup?.uuid ?? getDefaultBackupRegion());
|
|
287
|
+
// Cold recovery is a choice of the UI only: the backend gets the backup pair.
|
|
288
|
+
// "No" picks a non-failover pair. A copy of a failover pair starts on "Yes".
|
|
289
|
+
const initialBackupUuid = initialBackup?.uuid ?? getDefaultBackupRegion();
|
|
290
|
+
const [coldRecovery, setColdRecovery] = useState(formElements.region.options
|
|
291
|
+
.find((option) => option.uuid === defaultRegion)
|
|
292
|
+
?.backups.find((backup) => backup.uuid === initialBackupUuid)
|
|
293
|
+
?.failover === true);
|
|
224
294
|
const [encryptions, setEncryptions] = useState(getEncryptionsByProvider(defaultProvider));
|
|
225
295
|
const defaultEncryption = encryptions?.options
|
|
226
296
|
? (encryptions.options.find((enc) => enc.value === initialValues?.encryption)?.value ??
|
|
@@ -241,9 +311,22 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
241
311
|
formElements.clusterPlanType.options.every((option) => option.disabled)) ??
|
|
242
312
|
false;
|
|
243
313
|
// CONTEXT STATES
|
|
314
|
+
// True after the customer changed the size or the plan type.
|
|
315
|
+
const sizeTouched = useRef(false);
|
|
244
316
|
const updateNumberOfAllocatedHwPackages = (value) => {
|
|
317
|
+
sizeTouched.current = true;
|
|
245
318
|
setNumberOfAllocatedHwPackages(value);
|
|
246
319
|
};
|
|
320
|
+
// A replace frees the reservations of the source. Then the copy gets back
|
|
321
|
+
// the size of the source, unless the customer chose a size before.
|
|
322
|
+
const defaultAvailable = defaultClusterPlanType?.available;
|
|
323
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: only the free reservations restore the source size
|
|
324
|
+
useEffect(() => {
|
|
325
|
+
if (!sizeTouched.current) {
|
|
326
|
+
setNumberOfAllocatedHwPackages(fitSize(defaultClusterPlanType, initialValues?.numberOfAllocatedHwPackages ?? 1));
|
|
327
|
+
}
|
|
328
|
+
// Only a change of the free reservations restores the source size.
|
|
329
|
+
}, [defaultAvailable]);
|
|
247
330
|
const getSelectedChannel = () => {
|
|
248
331
|
const foundChannel = formElements.generation.channels.find((channel) => channel.uuid === selectedChannel);
|
|
249
332
|
return foundChannel;
|
|
@@ -282,25 +365,35 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
282
365
|
.map((option) => option.provider)
|
|
283
366
|
.filter((value, index, array) => array.lastIndexOf(value) === index)
|
|
284
367
|
.sort((a, b) => a.localeCompare(b));
|
|
368
|
+
const selectedRegion = formElements.region.options.find((option) => option.uuid === region);
|
|
369
|
+
const selectedBackup = selectedRegion?.backups.find((backup) => backup.uuid === backupRegion);
|
|
370
|
+
const dualMode = isDual(selectedBackup);
|
|
371
|
+
/**
|
|
372
|
+
* Sets the backup for a region. Cold recovery stays on only when the region
|
|
373
|
+
* has a failover pair. Else the backup falls back to dual region, and then
|
|
374
|
+
* to single region. "No" never picks a failover pair. A region with only
|
|
375
|
+
* failover pairs keeps cold recovery on.
|
|
376
|
+
* A plan with no `hotBackup` limit sends no backup.
|
|
377
|
+
*/
|
|
378
|
+
const selectBackup = (option, cold, dual) => {
|
|
379
|
+
const keepsCold = (cold || needsColdRecovery(option)) && pairsOf(option, true).length > 0;
|
|
380
|
+
const pairs = keepsCold ? pairsOf(option, true) : plainPairsOf(option);
|
|
381
|
+
const hasSingle = option?.backups.some((backup) => !isDual(backup));
|
|
382
|
+
// With no single backup, a pair is the only valid choice.
|
|
383
|
+
const useDual = (keepsCold || dual || !hasSingle) && pairs.length > 0;
|
|
384
|
+
setColdRecovery(useDual && keepsCold);
|
|
385
|
+
setBackupRegion(!formElements.region.dualRegionBackups || !option
|
|
386
|
+
? undefined
|
|
387
|
+
: useDual
|
|
388
|
+
? (pairs.find((pair) => pair.uuid === backupRegion) ?? pairs[0]).uuid
|
|
389
|
+
: (option.backups.find((backup) => !isDual(backup))?.uuid ?? ''));
|
|
390
|
+
};
|
|
285
391
|
/** `undefined` clears the selection, which a change of provider does. */
|
|
286
392
|
const updateRegion = (regionUuid) => {
|
|
287
393
|
setRegion(regionUuid);
|
|
288
394
|
setRegionValidation({ isValid: true, message: '' });
|
|
289
395
|
setSubmitBlockedMessage(undefined);
|
|
290
|
-
|
|
291
|
-
if (region) {
|
|
292
|
-
const defaultDualRegionBackups = formElements.region.dualRegionBackups
|
|
293
|
-
? (region.backups.find((backup) => backup.regions.length === 1)?.uuid ??
|
|
294
|
-
'')
|
|
295
|
-
: undefined;
|
|
296
|
-
setBackupRegion(defaultDualRegionBackups);
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
setBackupRegion(undefined);
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
const updateBackupRegion = (regionUuid) => {
|
|
303
|
-
setBackupRegion(regionUuid);
|
|
396
|
+
selectBackup(formElements.region.options.find((option) => option.uuid === regionUuid), coldRecovery, dualMode);
|
|
304
397
|
};
|
|
305
398
|
const updateEncryption = (value) => {
|
|
306
399
|
setEncryption(value);
|
|
@@ -346,6 +439,7 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
346
439
|
const foundClusterPlanType = getClusterPlanType();
|
|
347
440
|
const foundRegion = formElements.region.options.find((currentRegion) => currentRegion.uuid === region);
|
|
348
441
|
const foundBackupRegion = foundRegion?.backups.find((backup) => backup.uuid === backupRegion);
|
|
442
|
+
const secondRegion = secondRegionOf(foundRegion, foundBackupRegion);
|
|
349
443
|
const foundChannel = getSelectedChannel();
|
|
350
444
|
const foundGeneration = foundChannel
|
|
351
445
|
? foundChannel?.generations?.find((currentGeneration) => currentGeneration.uuid === selectedGeneration)
|
|
@@ -353,11 +447,16 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
353
447
|
return {
|
|
354
448
|
clusterPlanType: foundClusterPlanType ? foundClusterPlanType.title : '-',
|
|
355
449
|
region: foundRegion ? foundRegion.title : '-',
|
|
356
|
-
backup: foundBackupRegion
|
|
357
|
-
?
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
450
|
+
backup: !foundBackupRegion
|
|
451
|
+
? '-'
|
|
452
|
+
: isDual(foundBackupRegion)
|
|
453
|
+
? copy('backup.summary.dual', { secondRegion: secondRegion })
|
|
454
|
+
: copy('backup.summary.single'),
|
|
455
|
+
coldRecovery: coldRecovery
|
|
456
|
+
? copy('backup.summary.coldRecoveryYes', {
|
|
457
|
+
recoveryRegion: secondRegion,
|
|
458
|
+
})
|
|
459
|
+
: copy('backup.summary.coldRecoveryNo'),
|
|
361
460
|
channel: foundChannel ? foundChannel.title : '-',
|
|
362
461
|
generation: foundGeneration ? foundGeneration.title : '-',
|
|
363
462
|
stageTag: selectedTag,
|
|
@@ -562,7 +661,10 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
562
661
|
overflow: 'hidden',
|
|
563
662
|
zIndex: 1,
|
|
564
663
|
minHeight: '572px',
|
|
565
|
-
}, 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(FieldLabel, { style: summaryLabelStyle, children: "Provider and region" }), loading ? (_jsx(SkeletonText, {})) : summary.provider ? (`${summary.provider} - ${summary.region}`) : (summary.region)] }), formElements.region.dualRegionBackups &&
|
|
664
|
+
}, 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(FieldLabel, { style: summaryLabelStyle, children: "Provider and region" }), loading ? (_jsx(SkeletonText, {})) : summary.provider ? (`${summary.provider} - ${summary.region}`) : (summary.region)] }), formElements.region.dualRegionBackups &&
|
|
665
|
+
['backup', 'coldRecovery'].map((key) => (_jsxs(Stack, { gap: 1, children: [_jsx(FieldLabel, { style: summaryLabelStyle, children: copy(key === 'backup'
|
|
666
|
+
? 'backup.summary.backupTitle'
|
|
667
|
+
: 'backup.summary.coldRecoveryTitle') }), loading ? _jsx(SkeletonText, {}) : summary[key]] }, key))), summary.encryption && (_jsxs(Stack, { gap: 1, children: [_jsx(FieldLabel, { style: summaryLabelStyle, children: encryptions?.title ?? 'Encryption at rest' }), loading ? _jsx(SkeletonText, {}) : summary.encryption] })), _jsxs(Stack, { gap: 1, children: [_jsx(FieldLabel, { style: summaryLabelStyle, children: "Channel" }), loading ? _jsx(SkeletonText, {}) : summary.channel] }), _jsxs(Stack, { gap: 1, children: [_jsx(FieldLabel, { style: summaryLabelStyle, children: "Generation" }), loading ? _jsx(SkeletonText, {}) : summary.generation] }), _jsxs(Stack, { gap: 1, children: [_jsx(FieldLabel, { style: summaryLabelStyle, children: "Cluster tag" }), loading ? (_jsx(SkeletonText, {})) : (_jsx("span", { children: _jsx(ClusterTag, { stage: summary.stageTag }) }))] }), formElements.ttl && (_jsxs(Stack, { gap: 1, children: [_jsx(FieldLabel, { style: summaryLabelStyle, children: formElements.ttl.summaryLabel }), _jsx("span", { style: { overflowWrap: 'anywhere' }, children: summary.ttl })] }))] })] }), !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(SubmitStatus, { state: submitState, description: submitStateDescription })) : (_jsx(Button, { disabled: !clusterCreationAllowed(), style: { width: '100%' }, onClick: handleSubmit, children: cta.label })), cta.cancel && (_jsx(Button, { onClick: () => {
|
|
566
668
|
if (cta.cancel) {
|
|
567
669
|
cta.cancel.onClick();
|
|
568
670
|
}
|
|
@@ -572,21 +674,21 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
572
674
|
if (!formElements.ttl) {
|
|
573
675
|
return undefined;
|
|
574
676
|
}
|
|
575
|
-
return (_jsxs(
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
677
|
+
return (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.ttl.title }) }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4CreateClusterTtlSection, { ttl: formElements.ttl, value: ttl, onChange: updateTtl, unlimitedReason: ttlUnlimitedReason, onUnlimitedReasonChange: (value) => {
|
|
678
|
+
setTtlUnlimitedReason(value);
|
|
679
|
+
setTtlUnlimitedErrors((errors) => ({
|
|
680
|
+
...errors,
|
|
681
|
+
reason: undefined,
|
|
682
|
+
}));
|
|
683
|
+
setSubmitBlockedMessage(undefined);
|
|
684
|
+
}, unlimitedLink: ttlUnlimitedLink, onUnlimitedLinkChange: (value) => {
|
|
685
|
+
setTtlUnlimitedLink(value);
|
|
686
|
+
setTtlUnlimitedErrors((errors) => ({
|
|
687
|
+
...errors,
|
|
688
|
+
link: undefined,
|
|
689
|
+
}));
|
|
690
|
+
setSubmitBlockedMessage(undefined);
|
|
691
|
+
}, errors: ttlUnlimitedErrors, keepsSourceTtl: keepsSourceTtl, disabled: isSubmitting() || noAvailableSlots, reasonFieldRef: ttlUnlimitedReasonFieldRef, linkFieldRef: ttlUnlimitedLinkFieldRef }) })] }));
|
|
590
692
|
};
|
|
591
693
|
const renderTasklistV2Content = () => {
|
|
592
694
|
if (!(tasklistModeToggle?.enabled && generationIs8_8OrAboveAndLessThan8_10())) {
|
|
@@ -649,6 +751,113 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
649
751
|
.orgUnlockedGenerationsHelperText ??
|
|
650
752
|
'These are generations that have been unlocked for your organization.' })] }))] }))] }))] }) }));
|
|
651
753
|
};
|
|
754
|
+
/** A label over a group of choice cards, for the size and the backup. */
|
|
755
|
+
const choiceGroup = (title, value, onChange, cards, columns = 2, after) => (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(DsText, { as: 'p', variant: 'label-md', style: { margin: 0 }, children: title }) }), _jsx("div", { style: GRID_STYLE, children: _jsx(ChoiceCardGroup, { columns: columns, "aria-label": title, value: value, onValueChange: onChange, children: cards.map((card) => (_jsx(ChoiceCard, { ...card, disabled: card.disabled || isSubmitting() || noAvailableSlots }, card.value))) }) }), after] }));
|
|
756
|
+
const renderSizeSection = () => {
|
|
757
|
+
const sizes = formElements.allocatedHardwarePackages;
|
|
758
|
+
const planType = getClusterPlanType();
|
|
759
|
+
if (!sizes || !hasSizeChoice(planType)) {
|
|
760
|
+
return undefined;
|
|
761
|
+
}
|
|
762
|
+
// A size of N uses N reservations.
|
|
763
|
+
const free = planType?.available ?? 0;
|
|
764
|
+
const used = (planType?.used ?? 0) + numberOfAllocatedHwPackages;
|
|
765
|
+
const total = (planType?.used ?? 0) + free;
|
|
766
|
+
return choiceGroup(sizes.title, String(numberOfAllocatedHwPackages), (size) => updateNumberOfAllocatedHwPackages(Number(size)), Array.from({ length: sizes.max }, (_value, index) => ({
|
|
767
|
+
value: String(index + 1),
|
|
768
|
+
title: `${index + 1}x`,
|
|
769
|
+
description: free > index
|
|
770
|
+
? copy('hardwarePackages.reservationsPerSize', { count: index + 1 })
|
|
771
|
+
: copy('hardwarePackages.notEnoughReservations'),
|
|
772
|
+
disabled: free <= index,
|
|
773
|
+
})), 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
|
+
const renderBackupSection = () => {
|
|
776
|
+
const regionTitle = selectedRegion?.title ?? copy('backup.regionFallback');
|
|
777
|
+
const pairs = plainPairsOf(selectedRegion);
|
|
778
|
+
const coldPairs = pairsOf(selectedRegion, true);
|
|
779
|
+
const coldRegions = formElements.region.options
|
|
780
|
+
.filter((option) => option.provider === provider && pairsOf(option, true).length > 0)
|
|
781
|
+
.map((option) => option.title)
|
|
782
|
+
.join(', ');
|
|
783
|
+
// A region with no backup at all keeps single enabled, as before.
|
|
784
|
+
const singleOff = !!selectedRegion &&
|
|
785
|
+
selectedRegion.backups.some(isDual) &&
|
|
786
|
+
!selectedRegion.backups.some((backup) => !isDual(backup));
|
|
787
|
+
const planType = getClusterPlanType();
|
|
788
|
+
// Only the advanced offering has dual region, and it is the plan with a size choice.
|
|
789
|
+
const dualHinted = pairs.length > 0 && hasSizeChoice(planType);
|
|
790
|
+
const pairCards = (list, describe) => list.map((pair) => {
|
|
791
|
+
const label = secondRegionOf(selectedRegion, pair);
|
|
792
|
+
return { value: pair.uuid, title: label, description: describe(label) };
|
|
793
|
+
});
|
|
794
|
+
return (_jsxs(Stack, { gap: 4, children: [_jsxs("div", { style: GRID_STYLE, children: [_jsx(FormElementTitle, { title: copy('backup.title') }), _jsx("p", { children: formElements.region.backupDescription })] }), !selectedRegion ? (_jsx("div", { style: GRID_STYLE, children: _jsx("p", { style: { color: 'var(--neutral-foreground-subtle)' }, children: copy('backup.selectRegionFirst') }) })) : (_jsxs(_Fragment, { children: [choiceGroup(copy('backup.coldRecovery.question'), coldRecovery ? 'yes' : 'no', (choice) => selectBackup(selectedRegion, choice === 'yes', dualMode), [
|
|
795
|
+
{
|
|
796
|
+
value: 'no',
|
|
797
|
+
title: copy('backup.coldRecovery.no.title'),
|
|
798
|
+
description: needsColdRecovery(selectedRegion)
|
|
799
|
+
? copy('backup.coldRecovery.no.coldOnly', {
|
|
800
|
+
region: regionTitle,
|
|
801
|
+
})
|
|
802
|
+
: copy('backup.coldRecovery.no.description'),
|
|
803
|
+
icon: Archive,
|
|
804
|
+
disabled: needsColdRecovery(selectedRegion),
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
value: 'yes',
|
|
808
|
+
title: copy('backup.coldRecovery.yes.title'),
|
|
809
|
+
description: coldPairs.length > 0
|
|
810
|
+
? copy('backup.coldRecovery.yes.description')
|
|
811
|
+
: coldRegions
|
|
812
|
+
? copy('backup.coldRecovery.yes.notInRegion', {
|
|
813
|
+
region: regionTitle,
|
|
814
|
+
regions: coldRegions,
|
|
815
|
+
})
|
|
816
|
+
: copy('backup.coldRecovery.yes.nowhere', {
|
|
817
|
+
region: regionTitle,
|
|
818
|
+
}),
|
|
819
|
+
icon: LifeBuoy,
|
|
820
|
+
disabled: coldPairs.length === 0,
|
|
821
|
+
},
|
|
822
|
+
]), coldRecovery ? (choiceGroup(copy('backup.coldRecovery.recoveryRegion.title'), backupRegion ?? '', setBackupRegion, pairCards(coldPairs, (label) => copy('backup.coldRecovery.recoveryRegion.description', {
|
|
823
|
+
recoveryRegion: label,
|
|
824
|
+
region: regionTitle,
|
|
825
|
+
})), 2, _jsx("div", { style: GRID_STYLE, children: _jsx(Alert, { variant: 'info', title: copy('backup.coldRecovery.recoveryRegion.noticeTitle'), description: copy('backup.coldRecovery.recoveryRegion.noticeDescription', {
|
|
826
|
+
region: regionTitle,
|
|
827
|
+
recoveryRegion: secondRegionOf(selectedRegion, selectedBackup) ||
|
|
828
|
+
copy('backup.coldRecovery.recoveryRegion.recoveryRegionFallback'),
|
|
829
|
+
}) }) }))) : (_jsxs(_Fragment, { children: [choiceGroup(copy('backup.mode.title'), dualMode ? 'dual' : 'single', (mode) => selectBackup(selectedRegion, false, mode === 'dual'), [
|
|
830
|
+
{
|
|
831
|
+
value: 'single',
|
|
832
|
+
title: copy('backup.mode.single.title'),
|
|
833
|
+
description: singleOff
|
|
834
|
+
? copy('backup.mode.single.notInRegion', {
|
|
835
|
+
region: regionTitle,
|
|
836
|
+
})
|
|
837
|
+
: copy('backup.mode.single.description', {
|
|
838
|
+
region: regionTitle,
|
|
839
|
+
}),
|
|
840
|
+
icon: Database,
|
|
841
|
+
disabled: singleOff,
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
value: 'dual',
|
|
845
|
+
title: copy('backup.mode.dual.title'),
|
|
846
|
+
description: dualHinted
|
|
847
|
+
? `${copy('backup.mode.dual.description')} ${copy('backup.mode.dual.recommendedFor', { planType: planType?.title ?? '' })}`
|
|
848
|
+
: copy('backup.mode.dual.description'),
|
|
849
|
+
icon: Copy,
|
|
850
|
+
disabled: pairs.length === 0,
|
|
851
|
+
badge: dualHinted ? (_jsx(DsBadge, { variant: 'primary', children: copy('backup.mode.dual.recommendedBadge') })) : undefined,
|
|
852
|
+
},
|
|
853
|
+
]), pairs.length === 0 && (_jsx("div", { style: GRID_STYLE, children: _jsx(Alert, { variant: 'info', description: copy(coldPairs.length > 0
|
|
854
|
+
? 'backup.mode.dual.onlyWithColdRecovery'
|
|
855
|
+
: 'backup.mode.dual.notInRegion', { region: regionTitle }) }) })), dualMode &&
|
|
856
|
+
choiceGroup(copy('backup.secondRegion.title'), backupRegion ?? '', setBackupRegion, pairCards(pairs, (label) => copy('backup.secondRegion.description', {
|
|
857
|
+
region: regionTitle,
|
|
858
|
+
secondRegion: label,
|
|
859
|
+
})))] }))] }))] }));
|
|
860
|
+
};
|
|
652
861
|
const renderContent = () => {
|
|
653
862
|
if (loading) {
|
|
654
863
|
return (_jsx("div", { style: GRID_STYLE, children: _jsx(SkeletonText, {}) }));
|
|
@@ -693,35 +902,31 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
693
902
|
});
|
|
694
903
|
setSubmitBlockedMessage(undefined);
|
|
695
904
|
setClusterDescription(event.target.value);
|
|
696
|
-
} }), !clusterDescriptionValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-foreground-subtle', children: clusterDescriptionValidation.message }))] }) })] })),
|
|
905
|
+
} }), !clusterDescriptionValidation.isValid && (_jsx("span", { className: 'mt-1 block text-xs text-danger-foreground-subtle', children: clusterDescriptionValidation.message }))] }) })] })), _jsxs(Stack, { gap: 5, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.stageLabel.title }) }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4ClusterTagSelector, { boxes: formElements.stageLabel.boxes, isDevCluster: getClusterPlanType()?.type === 'dev', onChange: (selected) => {
|
|
906
|
+
setSelectedTag(selected);
|
|
907
|
+
setAuthorizationEnabled(selected === 'prod' || selected === 'stage');
|
|
908
|
+
}, save: { allowed: !noAvailableSlots }, currentStage: selectedTag, allowedTags: selectedPlan?.type
|
|
909
|
+
? enableMap[selectedPlan?.type]
|
|
910
|
+
: enableMap.prod }) }), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: formElements.stageLabel.textBelow }) })] }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), _jsxs("div", { ref: regionSectionRef, style: { display: 'flex', flexDirection: 'column', gap: '0.25rem' }, children: [_jsxs("div", { style: GRID_STYLE, children: [_jsx(FormElementTitle, { title: formElements.region.title, required: true }), !regionValidation.isValid && (_jsx("p", { style: {
|
|
697
911
|
color: 'var(--danger-foreground-subtle)',
|
|
698
912
|
marginTop: '0.25rem',
|
|
699
913
|
marginBottom: '0.5rem',
|
|
700
|
-
}, children: regionValidation.message })), getUniqueProviders().length > 1 && (_jsx(C4SegmentedControl
|
|
914
|
+
}, children: regionValidation.message })), getUniqueProviders().length > 1 && (_jsx(C4SegmentedControl
|
|
915
|
+
// Text and no logo: the trademark rules of AWS and Google
|
|
916
|
+
// allow no logo here.
|
|
917
|
+
, {
|
|
918
|
+
// Text and no logo: the trademark rules of AWS and Google
|
|
919
|
+
// allow no logo here.
|
|
920
|
+
options: getUniqueProviders().map((name) => ({
|
|
701
921
|
id: name,
|
|
702
|
-
label: name
|
|
922
|
+
label: name === 'AWS' || name === 'GCP'
|
|
923
|
+
? copy(`region.providers.${name.toLowerCase()}`)
|
|
924
|
+
: name,
|
|
703
925
|
})), value: provider, onChange: updateProvider, ariaLabel: 'Select cloud provider', dsStyle: { marginBottom: '0.5rem' } }))] }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4CreateClusterTileGrid, { items: formElements.region.options.filter((option) => option.provider === provider), getKey: (option) => option.uuid, getLabel: (option) => option.title,
|
|
704
|
-
//
|
|
705
|
-
//
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
if (formElements.region.dualRegionBackups) {
|
|
709
|
-
const selectedRegion = formElements.region.options.find((reg) => reg.uuid === region);
|
|
710
|
-
return (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.region.backupRegionTitle }) }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4CreateClusterTileGrid, { items: selectedRegion?.backups ?? [], getKey: (option) => option.uuid, getLabel: (option) => `${option.regions.length > 1
|
|
711
|
-
? 'Dual region: '
|
|
712
|
-
: 'Single region: '}${option.regions.map((reg) => reg.label).join(', ')}`, getBadge: (option) => {
|
|
713
|
-
if (option.failover) {
|
|
714
|
-
return (_jsx(Tag, { type: 'green', size: 'sm', children: "Cold recovery supported" }));
|
|
715
|
-
}
|
|
716
|
-
// A single-region backup keeps no copy in a second
|
|
717
|
-
// region, thus it gets no tag.
|
|
718
|
-
return option.regions.length > 1 ? (_jsx(Tag, { type: 'gray', size: 'sm', children: "Secondary backup only" })) : undefined;
|
|
719
|
-
}, getDisabled: () => isSubmitting() || noAvailableSlots, value: backupRegion, onChange: updateBackupRegion, ariaLabel: formElements.region.backupRegionTitle, columnWidth: '260px', searchPlaceholder: 'Search backup regions' }, region) }), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: formElements.region.backupDescription }) })] }));
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
return _jsx(_Fragment, {});
|
|
723
|
-
}
|
|
724
|
-
})(), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), _jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.clusterPlanType.title }) }), _jsx("div", { style: { padding: '0 1rem' }, children: _jsx(ChoiceCardGroup, { "aria-label": formElements.clusterPlanType.title, value: currentClusterPlanType, onValueChange: setClusterPlanTypeWithEffects, style: {
|
|
926
|
+
// The badge says which regions can have cold recovery. It is no
|
|
927
|
+
// recommendation: the customer cannot change the region later.
|
|
928
|
+
getBadge: (option) => formElements.region.dualRegionBackups &&
|
|
929
|
+
pairsOf(option, true).length > 0 ? (_jsx(DsBadge, { variant: 'info', children: copy('backup.regionBadge') })) : undefined, getDisabled: () => isSubmitting() || noAvailableSlots, value: region, onChange: updateRegion, ariaLabel: formElements.region.title, columnWidth: '220px', searchPlaceholder: 'Search regions' }, provider) }), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: formElements.region.description }) })] }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), _jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.clusterPlanType.title }) }), _jsx("div", { style: { padding: '0 1rem' }, children: _jsx(ChoiceCardGroup, { "aria-label": formElements.clusterPlanType.title, value: currentClusterPlanType, onValueChange: setClusterPlanTypeWithEffects, style: {
|
|
725
930
|
gridTemplateColumns: 'repeat(auto-fill, minmax(320px, 1fr))',
|
|
726
931
|
gap: '1rem',
|
|
727
932
|
}, children: formElements.clusterPlanType.options.map((option) => (_jsx(ChoiceCard, { value: option.uuid, title: option.title, description: option.description, icon: option.type === 'dev' ? Code : Database, disabled: option.disabled || isSubmitting() || noAvailableSlots }, option.uuid))) }) })] }), formElements.clusterPlan &&
|
|
@@ -735,50 +940,23 @@ export const C4CreateCluster = ({ loading, cta, formElements, autoUpdate, taskli
|
|
|
735
940
|
title: formElements.clusterPlan.defaultLabel,
|
|
736
941
|
},
|
|
737
942
|
...formElements.clusterPlan.options,
|
|
738
|
-
].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 })] })), formElements.
|
|
739
|
-
formElements.clusterPlanType.options.find((option) => option.uuid === currentClusterPlanType &&
|
|
740
|
-
option.category === ClusterPlanTypeCategory.ADVANCED_OFFERING &&
|
|
741
|
-
option.availabilityClass !== 'unset' &&
|
|
742
|
-
option.availabilityClass !== undefined) !== undefined && (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: formElements.allocatedHardwarePackages.title }), _jsx("div", { style: { marginLeft: '1rem' }, children: Array.from(Array(formElements.allocatedHardwarePackages.max), (_d, i) => i).map((val) => {
|
|
743
|
-
const isHwPackageDisabled = (getClusterPlanType()?.available ?? 0) < val + 1;
|
|
744
|
-
return (_jsxs(Tag, { id: `allocatedHardwarePackages-${val + 1}`, onClick: () => {
|
|
745
|
-
updateNumberOfAllocatedHwPackages(val + 1);
|
|
746
|
-
}, type: numberOfAllocatedHwPackages === val + 1
|
|
747
|
-
? 'high-contrast'
|
|
748
|
-
: 'outline', style: {
|
|
749
|
-
borderWidth: '0px',
|
|
750
|
-
cursor: isHwPackageDisabled ? 'not-allowed' : 'pointer',
|
|
751
|
-
}, disabled: isHwPackageDisabled, children: [val + 1, "x"] }, `allocatedHardwarePackages-${val + 1}`));
|
|
752
|
-
}) }), _jsx("p", { style: { marginLeft: '1rem' }, children: formElements.allocatedHardwarePackages.description }), _jsx("p", { style: { marginLeft: '1rem' }, children: _jsxs("strong", { children: [formElements.allocatedHardwarePackages.bold, ":", ' ', getClusterPlanType()?.used, " Used /", ' ', (getClusterPlanType()?.used ?? 0) +
|
|
753
|
-
(getClusterPlanType()?.available ?? 0), ' ', "Total"] }) }), _jsx("p", { style: { marginLeft: '1rem' }, children: _jsx(C4ExternalLink, { id: 'allocatedHardwarePackages-docs', inline: true, label: formElements.allocatedHardwarePackages.link.label, href: formElements.allocatedHardwarePackages.link.href }) })] })), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), _jsxs(Stack, { gap: 5, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.stageLabel.title }) }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4ClusterTagSelector, { boxes: formElements.stageLabel.boxes, isDevCluster: !!(getClusterPlanType() && getClusterPlanType()?.type === 'dev'), onChange: (selected) => {
|
|
754
|
-
setSelectedTag(selected);
|
|
755
|
-
switch (selected) {
|
|
756
|
-
case 'prod':
|
|
757
|
-
case 'stage': {
|
|
758
|
-
setAuthorizationEnabled(true);
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
default: {
|
|
762
|
-
setAuthorizationEnabled(false);
|
|
763
|
-
break;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
}, save: { allowed: !noAvailableSlots }, currentStage: selectedTag, allowedTags: selectedPlan?.type
|
|
767
|
-
? enableMap[selectedPlan?.type]
|
|
768
|
-
: enableMap.prod }) }), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: formElements.stageLabel.textBelow }) })] }), _jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) }), renderTtlSection(), _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) => ({
|
|
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) => ({
|
|
769
944
|
id: channel.uuid,
|
|
770
945
|
label: channel.title,
|
|
771
946
|
disabled: noAvailableSlots || channel.isEmpty,
|
|
772
947
|
tooltip: channel.isEmpty && channel.title === 'Alpha'
|
|
773
948
|
? formElements.generation.emptyChannelNote
|
|
774
949
|
: undefined,
|
|
775
|
-
})), value: selectedChannel, onChange: updateSelectedChannel, ariaLabel: formElements.generation.title }) }), getSelectedChannel() && (_jsxs(Stack, { gap: 4, children: [_jsx("div", { style: { maxWidth: '58.33%' }, children: _jsx("p", { children: getSelectedChannel()?.description }) }), renderGenerationSection()] }))] }) }),
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
950
|
+
})), value: selectedChannel, onChange: updateSelectedChannel, ariaLabel: formElements.generation.title }) }), getSelectedChannel() && (_jsxs(Stack, { gap: 4, children: [_jsx("div", { style: { maxWidth: '58.33%' }, children: _jsx("p", { children: getSelectedChannel()?.description }) }), renderGenerationSection()] }))] }) }), tasklistModeToggle?.enabled && renderTasklistV2Content(), ((authorizationToggle?.enabled && generationIs8_8OrAbove()) ||
|
|
951
|
+
autoUpdate?.enabled ||
|
|
952
|
+
formElements.ttl ||
|
|
953
|
+
(encryptions && providerSupportsEncryption())) && (_jsx("div", { style: GRID_STYLE, children: _jsx(C4Divider, {}) })), authorizationToggle?.enabled && renderAuthorizationRadio(), autoUpdate?.enabled && (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: formElements.autoUpdate?.title ?? '' }) }), autoUpdateEnabled && (_jsx("div", { style: GRID_STYLE, children: _jsx(Checkbox, { id: 'autoupdate', labelText: formElements.autoUpdate?.label ?? '', checked: autoUpdateChecked, onChange: (event) => {
|
|
954
|
+
setAutoUpdateChecked(event.target.checked);
|
|
955
|
+
}, disabled: isSubmitting() || !autoUpdateEnabled || noAvailableSlots }, 'autoupdate') })), _jsx("div", { style: GRID_STYLE, children: _jsx("p", { children: autoUpdateEnabled
|
|
956
|
+
? formElements.autoUpdate?.description
|
|
957
|
+
: formElements.autoUpdate?.descriptionIfDisabled }) })] })), renderTtlSection(), encryptions && providerSupportsEncryption() && (_jsxs(Stack, { gap: 2, children: [_jsx("div", { style: GRID_STYLE, children: _jsx(FormElementTitle, { title: encryptions.title }) }), _jsxs(Stack, { gap: 6, children: [_jsx("div", { style: GRID_STYLE, children: _jsxs("p", { children: [encryptions.description.text, ' ', _jsx("strong", { children: encryptions.description.bold }), ' ', _jsx(C4LinkButton, { label: encryptions.link.text, onClick: () => {
|
|
958
|
+
window.open(encryptions?.link.url ?? '', '_blank');
|
|
959
|
+
} })] }) }), _jsx("div", { style: GRID_STYLE, 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' }) })] })] }))] }));
|
|
782
960
|
};
|
|
783
961
|
const renderReplaceConfirmModal = () => {
|
|
784
962
|
const replace = duplicate?.replace;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
4
|
* You may not use this file except in compliance with the commercial license.
|
|
5
5
|
*/
|
|
6
|
-
import { isHttpUrl } from '@camunda/ccma-shared-types';
|
|
6
|
+
import { ClusterPlanTypeCategory, isHttpUrl } from '@camunda/ccma-shared-types';
|
|
7
7
|
export const stageLabel = {
|
|
8
8
|
title: 'Cluster tag',
|
|
9
9
|
textBelow: 'Assign a tag to make it easier for team members to clearly distinguish between different stages of the software development lifecycle. Tags can be changed later.',
|
|
@@ -61,7 +61,10 @@ export const generateClusterPlanTypeOptions = (options) => {
|
|
|
61
61
|
description: `designed for production-ready use-cases.`,
|
|
62
62
|
default: false,
|
|
63
63
|
disabled: false,
|
|
64
|
+
category: ClusterPlanTypeCategory.ADVANCED_OFFERING,
|
|
64
65
|
availabilityClass: 'Standard',
|
|
66
|
+
used: 1,
|
|
67
|
+
available: 2,
|
|
65
68
|
});
|
|
66
69
|
}
|
|
67
70
|
return clusterPlanTypes;
|
|
@@ -2,6 +2,7 @@ import type { CamundaClusterStageLabel } from '@camunda/camunda-composite-compon
|
|
|
2
2
|
import type { ClusterTtlOption } from '@camunda/ccma-shared-types';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
import type { MigrationIdentity } from '../../utils/migration-workaround.js';
|
|
5
|
+
import type { TranslateFn } from '../../utils/safe-translate.js';
|
|
5
6
|
export interface C4CreateClusterCtaParameters {
|
|
6
7
|
name: string;
|
|
7
8
|
description?: string;
|
|
@@ -282,13 +283,19 @@ export interface C4CreateClusterProps {
|
|
|
282
283
|
};
|
|
283
284
|
region: {
|
|
284
285
|
title: string;
|
|
285
|
-
|
|
286
|
+
/** @deprecated The backup section heading comes from `backup.title`. */
|
|
287
|
+
backupRegionTitle?: string;
|
|
286
288
|
description: ReactNode;
|
|
287
289
|
backupDescription: ReactNode;
|
|
288
290
|
dualRegionBackups: boolean;
|
|
289
291
|
options: C4CreateClusterRegion[];
|
|
290
292
|
validationMessage?: string;
|
|
291
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* Translates the backup, provider and size text, which have keys under
|
|
296
|
+
* `createcluster:form`. Without it, the form shows English.
|
|
297
|
+
*/
|
|
298
|
+
t?: TranslateFn;
|
|
292
299
|
generation: {
|
|
293
300
|
title: string;
|
|
294
301
|
channels: C4CreateClusterChannelWithGenerations[];
|
|
@@ -53,19 +53,82 @@
|
|
|
53
53
|
"hardwarePackages": {
|
|
54
54
|
"title": "Cluster size",
|
|
55
55
|
"description": "Increase the cluster size to enhance performance and capacity. Each size increase uses an additional reservation slot.",
|
|
56
|
-
"bold": "Reservations
|
|
57
|
-
"link": "Learn more about cluster size"
|
|
56
|
+
"bold": "Reservations",
|
|
57
|
+
"link": "Learn more about cluster size",
|
|
58
|
+
"reservationsPerSize_one": "Uses {{count}} reservation",
|
|
59
|
+
"reservationsPerSize_other": "Uses {{count}} reservations",
|
|
60
|
+
"notEnoughReservations": "Not enough reservations",
|
|
61
|
+
"reservationsUsed": "{{used}} of {{total}} used, with this cluster"
|
|
58
62
|
},
|
|
59
63
|
"region": {
|
|
60
64
|
"title": "Select region",
|
|
61
65
|
"description": "To minimize network latency and traffic costs, select your preferred cloud provider and a region near your client application and/or users.",
|
|
62
66
|
"teaseForEnterprise": "Custom regions are available in the Enterprise plan and you can <0>contact us</0> to know more.",
|
|
63
|
-
"validationMessage": "Please select a region for your cluster"
|
|
67
|
+
"validationMessage": "Please select a region for your cluster",
|
|
68
|
+
"providers": {
|
|
69
|
+
"aws": "Amazon Web Services (AWS)",
|
|
70
|
+
"gcp": "Google Cloud (GCP)"
|
|
71
|
+
}
|
|
64
72
|
},
|
|
65
73
|
"backupRegion": {
|
|
66
74
|
"title": "Backup location",
|
|
67
75
|
"description": "Choose single region to keep your data in one place, or dual region for higher redundancy across geographically separate locations. Some dual-region locations also support cross-region cold recovery, while others only keep a secondary copy of your backups. <0>Learn more</0>"
|
|
68
76
|
},
|
|
77
|
+
"backup": {
|
|
78
|
+
"title": "Backup and recovery",
|
|
79
|
+
"selectRegionFirst": "Select a region to see the backup options.",
|
|
80
|
+
"regionBadge": "Cold recovery",
|
|
81
|
+
"regionFallback": "the region",
|
|
82
|
+
"coldRecovery": {
|
|
83
|
+
"question": "Do you need cold recovery?",
|
|
84
|
+
"no": {
|
|
85
|
+
"title": "No",
|
|
86
|
+
"description": "Choose a backup option for this cluster.",
|
|
87
|
+
"coldOnly": "Not available in {{region}}. Select Yes, enable cold recovery."
|
|
88
|
+
},
|
|
89
|
+
"yes": {
|
|
90
|
+
"title": "Yes, enable cold recovery",
|
|
91
|
+
"description": "If the region fails, you can restart the cluster in a second region. Backups are kept in both regions.",
|
|
92
|
+
"notInRegion": "Not available in {{region}}. Available in: {{regions}}.",
|
|
93
|
+
"nowhere": "Not available in {{region}}."
|
|
94
|
+
},
|
|
95
|
+
"recoveryRegion": {
|
|
96
|
+
"title": "Recovery region",
|
|
97
|
+
"description": "Restart in {{recoveryRegion}} if {{region}} fails.",
|
|
98
|
+
"noticeTitle": "Dual region backup is included",
|
|
99
|
+
"noticeDescription": "Cold recovery uses dual region backup. Camunda keeps backups in {{region}} and in {{recoveryRegion}}.",
|
|
100
|
+
"recoveryRegionFallback": "the recovery region"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"mode": {
|
|
104
|
+
"title": "Backup",
|
|
105
|
+
"single": {
|
|
106
|
+
"title": "Single region",
|
|
107
|
+
"description": "Backups stay in {{region}}.",
|
|
108
|
+
"notInRegion": "Not available in {{region}}. Select dual region instead."
|
|
109
|
+
},
|
|
110
|
+
"dual": {
|
|
111
|
+
"title": "Dual region",
|
|
112
|
+
"description": "Backups are copied to a second region.",
|
|
113
|
+
"recommendedFor": "Recommended for {{planType}} clusters.",
|
|
114
|
+
"recommendedBadge": "Recommended",
|
|
115
|
+
"notInRegion": "Dual region is not available in {{region}}. Select another region to use it.",
|
|
116
|
+
"onlyWithColdRecovery": "Dual region is available in {{region}} only with cold recovery. To use it, select Yes, enable cold recovery."
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"secondRegion": {
|
|
120
|
+
"title": "Second region",
|
|
121
|
+
"description": "Backups in {{region}} and {{secondRegion}}"
|
|
122
|
+
},
|
|
123
|
+
"summary": {
|
|
124
|
+
"backupTitle": "Backup",
|
|
125
|
+
"single": "Single region",
|
|
126
|
+
"dual": "Dual region: {{secondRegion}}",
|
|
127
|
+
"coldRecoveryTitle": "Cold recovery",
|
|
128
|
+
"coldRecoveryYes": "Yes, in {{recoveryRegion}}",
|
|
129
|
+
"coldRecoveryNo": "No"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
69
132
|
"generation": {
|
|
70
133
|
"title": "Channel",
|
|
71
134
|
"olderGenerationsLabel": "View older generations",
|
|
@@ -311,7 +311,7 @@ export function buildCreateClusterTranslations(t) {
|
|
|
311
311
|
planTypeTitle: translate('createcluster:form.clusterPlanType.title', 'Select a cluster type'),
|
|
312
312
|
hardwarePackagesTitle: translate('createcluster:form.hardwarePackages.title', 'Cluster size'),
|
|
313
313
|
hardwarePackagesDescription: translate('createcluster:form.hardwarePackages.description', 'Increase the cluster size to enhance performance and capacity. Each size increase uses an additional reservation slot.'),
|
|
314
|
-
hardwarePackagesBold: translate('createcluster:form.hardwarePackages.bold', 'Reservations
|
|
314
|
+
hardwarePackagesBold: translate('createcluster:form.hardwarePackages.bold', 'Reservations'),
|
|
315
315
|
hardwarePackagesLink: translate('createcluster:form.hardwarePackages.link', 'Learn more about cluster size'),
|
|
316
316
|
regionTitle: translate('createcluster:form.region.title', 'Select region'),
|
|
317
317
|
regionDescription: translate('createcluster:form.region.description', 'To minimize network latency and traffic costs, select your preferred cloud provider and a region near your client application and/or users.'),
|
|
@@ -1210,6 +1210,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1210
1210
|
},
|
|
1211
1211
|
},
|
|
1212
1212
|
},
|
|
1213
|
+
t: runtime.i18n?.t,
|
|
1213
1214
|
encryptionGCP,
|
|
1214
1215
|
encryptionAWS,
|
|
1215
1216
|
...(clusterTtlEnabled && { ttl: buildTtlFormElement(translations) }),
|
|
@@ -1274,6 +1275,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
1274
1275
|
}, [
|
|
1275
1276
|
loading,
|
|
1276
1277
|
translations,
|
|
1278
|
+
runtime.i18n?.t,
|
|
1277
1279
|
planTypes,
|
|
1278
1280
|
unlockedClusterPlans,
|
|
1279
1281
|
initialValues,
|