@camunda/ccma-saas-frontend 0.31.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +3 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +2 -2
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.d.ts +2 -1
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.js +46 -15
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.types.d.ts +47 -12
- package/lib/esm/components/c4-cluster-migration/migration-translations.d.ts +2 -4
- package/lib/esm/components/c4-cluster-migration/migration-translations.js +90 -15
- package/lib/esm/i18n/en/pages/clusterdetails.json +63 -14
- package/lib/esm/i18n/en/pages/createcluster.json +1 -1
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/runtime/use-c4-two-phase-upgrade-mockup.d.ts +5 -1
- package/lib/esm/runtime/use-c4-two-phase-upgrade-mockup.js +4 -2
- package/lib/esm/utils/migration-aws-policy.d.ts +22 -0
- package/lib/esm/utils/migration-aws-policy.js +54 -0
- package/lib/esm/utils/migration-view.d.ts +98 -0
- package/lib/esm/utils/migration-view.js +52 -0
- package/lib/esm/utils/migration-workaround.d.ts +46 -32
- package/lib/esm/utils/migration-workaround.js +212 -48
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +50 -40
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +3 -2
- package/lib/esm/widgets/clusters/c4-clusters-page.js +8 -7
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +3 -3
- package/package.json +3 -3
- package/lib/esm/components/c4-cluster-migration/backup-id.d.ts +0 -2
- package/lib/esm/components/c4-cluster-migration/backup-id.js +0 -9
|
@@ -19,7 +19,8 @@ import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-bl
|
|
|
19
19
|
import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
|
|
20
20
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
21
21
|
import { Modal, Stack, TextInput } from '../../ui/index.js';
|
|
22
|
-
import {
|
|
22
|
+
import { isMigrationLocked, } from '../../utils/migration-view.js';
|
|
23
|
+
import { buildBackupChoiceUpdate, buildReopenTransferUpdate, buildTransferFinishedUpdate, getMigrationView, isMigrationPlan, MIGRATION_NAME_MAX_LENGTH, } from '../../utils/migration-workaround.js';
|
|
23
24
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
24
25
|
import { clusterHealthOverride } from '../cluster-health-override.js';
|
|
25
26
|
import { useClusterApiClients } from '../environment/use-cluster-api-clients.js';
|
|
@@ -540,7 +541,7 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
540
541
|
cluster?.status?.zeebeRestUrl,
|
|
541
542
|
reloadStatisticsConfig,
|
|
542
543
|
]);
|
|
543
|
-
// TODO(3844-workaround): The
|
|
544
|
+
// TODO(3844-workaround): The view comes from the name prefix and labels.
|
|
544
545
|
const migrationFlagOn = useC4FeatureFlag(SELF_MANAGED_MIGRATION_FLAG);
|
|
545
546
|
const migrationOrgInfo = data.getOrgInfo(props.orgId);
|
|
546
547
|
// An unknown plan (slow or failed org request) keeps a prefixed cluster
|
|
@@ -548,28 +549,35 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
548
549
|
const migrationPlanType = migrationOrgInfo?.organizationToSalesPlan?.salesPlan?.salesPlanType;
|
|
549
550
|
const clusterName = cluster?.name;
|
|
550
551
|
const clusterDescription = cluster?.description;
|
|
551
|
-
|
|
552
|
+
const clusterLabels = cluster?.labels;
|
|
553
|
+
// Memoized, so that `onMigrationUpdate` and the tabs keep their identity
|
|
552
554
|
// between renders.
|
|
553
|
-
const
|
|
555
|
+
const migrationView = useMemo(() => migrationFlagOn &&
|
|
554
556
|
isMigrationPlan(migrationPlanType) &&
|
|
555
557
|
clusterName !== undefined
|
|
556
|
-
?
|
|
558
|
+
? getMigrationView({
|
|
557
559
|
name: clusterName,
|
|
558
560
|
description: clusterDescription,
|
|
561
|
+
labels: clusterLabels,
|
|
559
562
|
})
|
|
560
|
-
: undefined, [
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
563
|
+
: undefined, [
|
|
564
|
+
migrationFlagOn,
|
|
565
|
+
migrationPlanType,
|
|
566
|
+
clusterName,
|
|
567
|
+
clusterDescription,
|
|
568
|
+
clusterLabels,
|
|
569
|
+
]);
|
|
570
|
+
const migrationLocked = isMigrationLocked(migrationView);
|
|
565
571
|
// Only a known Enterprise plan may submit. An unknown plan keeps the lock
|
|
566
|
-
// but never
|
|
567
|
-
const
|
|
572
|
+
// but never submits.
|
|
573
|
+
const migrationCanEdit = migrationPlanType === SalesPlanType.ENTERPRISE &&
|
|
568
574
|
Boolean(authz.visibilities.clusters?.canEdit);
|
|
569
575
|
// TODO(3844-workaround): Rename stays open in a migration state, so a tester
|
|
570
576
|
// can change the name prefix and with it the state.
|
|
571
577
|
const canRename = Boolean(authz.visibilities.clusters?.canEdit);
|
|
572
|
-
|
|
578
|
+
// Delete stays open in every phase: deleting the cluster cancels the
|
|
579
|
+
// migration (ADR 0008).
|
|
580
|
+
const canDelete = Boolean(authz.visibilities.clusters?.canDelete);
|
|
573
581
|
const { hasIdentityIntegration, useClusterSecretsLabel } = useClusterVersionFlags(cluster);
|
|
574
582
|
const [dismissedFailedRestores, setDismissedFailedRestores] = useState(loadDismissedFailedRestores);
|
|
575
583
|
const dismissFailedRestore = useCallback((restoreId) => {
|
|
@@ -656,10 +664,10 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
656
664
|
setClusterMutationError('');
|
|
657
665
|
}
|
|
658
666
|
}, [deleteOpen]);
|
|
659
|
-
// TODO(3844-workaround):
|
|
660
|
-
//
|
|
661
|
-
const
|
|
662
|
-
if (!
|
|
667
|
+
// TODO(3844-workaround): Each step of the customer renames the cluster
|
|
668
|
+
// and writes its labels. The operator integration writes the spec instead.
|
|
669
|
+
const onMigrationUpdate = useCallback(async (build) => {
|
|
670
|
+
if (!migrationView || !migrationCanEdit)
|
|
663
671
|
return;
|
|
664
672
|
setClusterMutationBusy(true);
|
|
665
673
|
setClusterMutationError('');
|
|
@@ -667,10 +675,7 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
667
675
|
await ConsoleClusterService.updateCluster({
|
|
668
676
|
config: apiConfig,
|
|
669
677
|
params: { orgId: props.orgId, clusterId: props.clusterId },
|
|
670
|
-
body:
|
|
671
|
-
name: buildMigrateName(migrationInfo.displayName),
|
|
672
|
-
labels: withBackupIdLabel(cluster?.labels, backupId),
|
|
673
|
-
},
|
|
678
|
+
body: build(migrationView, clusterLabels),
|
|
674
679
|
});
|
|
675
680
|
await reloadCluster();
|
|
676
681
|
}
|
|
@@ -684,22 +689,22 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
684
689
|
apiConfig,
|
|
685
690
|
props.orgId,
|
|
686
691
|
props.clusterId,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
692
|
+
migrationView,
|
|
693
|
+
migrationCanEdit,
|
|
694
|
+
clusterLabels,
|
|
690
695
|
reloadCluster,
|
|
691
696
|
]);
|
|
692
|
-
// TODO(3844-workaround): A
|
|
693
|
-
//
|
|
694
|
-
|
|
697
|
+
// TODO(3844-workaround): A later step can write a longer prefix. Then it
|
|
698
|
+
// cuts the name to 50 characters. This limit keeps a renamed name short
|
|
699
|
+
// enough, so that no step cuts it.
|
|
700
|
+
const renamedMigrationView = migrationView === undefined
|
|
695
701
|
? undefined
|
|
696
|
-
:
|
|
702
|
+
: getMigrationView({
|
|
697
703
|
name: newClusterName,
|
|
698
704
|
description: clusterDescription,
|
|
699
705
|
});
|
|
700
|
-
const renameTooLongForMigration =
|
|
701
|
-
|
|
702
|
-
renamedMigrationInfo.displayName.length > MIGRATION_NAME_MAX_LENGTH;
|
|
706
|
+
const renameTooLongForMigration = renamedMigrationView !== undefined &&
|
|
707
|
+
renamedMigrationView.displayName.length > MIGRATION_NAME_MAX_LENGTH;
|
|
703
708
|
const onRename = async () => {
|
|
704
709
|
setClusterMutationBusy(true);
|
|
705
710
|
setClusterMutationError('');
|
|
@@ -1584,15 +1589,19 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1584
1589
|
init: () => { },
|
|
1585
1590
|
},
|
|
1586
1591
|
];
|
|
1587
|
-
//
|
|
1588
|
-
if (
|
|
1592
|
+
// A locked cluster shows only the migration panel.
|
|
1593
|
+
if (migrationView && migrationLocked) {
|
|
1589
1594
|
return [
|
|
1590
1595
|
{
|
|
1591
1596
|
id: 'overview',
|
|
1592
1597
|
label: tabLabel('overview'),
|
|
1593
|
-
component: (_jsx(C4ClusterMigration, {
|
|
1594
|
-
void
|
|
1595
|
-
},
|
|
1598
|
+
component: (_jsx(C4ClusterMigration, { migration: migrationView, busy: clusterMutationBusy, canEdit: migrationCanEdit, error: clusterMutationError, onTransferFinished: (source) => {
|
|
1599
|
+
void onMigrationUpdate((view, labels) => buildTransferFinishedUpdate(view, labels, source));
|
|
1600
|
+
}, onReopenTransfer: () => {
|
|
1601
|
+
void onMigrationUpdate(buildReopenTransferUpdate);
|
|
1602
|
+
}, onChooseBackup: (choice) => {
|
|
1603
|
+
void onMigrationUpdate((view, labels) => buildBackupChoiceUpdate(view, labels, choice));
|
|
1604
|
+
}, onDelete: canDelete ? () => setDeleteOpen(true) : undefined, translations: buildMigrationTranslations(t) })),
|
|
1596
1605
|
visible: true,
|
|
1597
1606
|
},
|
|
1598
1607
|
];
|
|
@@ -1607,10 +1616,11 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1607
1616
|
initializeTab: tab.id === activeTabId ? tab.init : undefined,
|
|
1608
1617
|
}));
|
|
1609
1618
|
}, [
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1619
|
+
migrationView,
|
|
1620
|
+
migrationLocked,
|
|
1621
|
+
migrationCanEdit,
|
|
1622
|
+
onMigrationUpdate,
|
|
1623
|
+
canDelete,
|
|
1614
1624
|
clusterMutationBusy,
|
|
1615
1625
|
clusterMutationError,
|
|
1616
1626
|
activeTabId,
|
|
@@ -20,7 +20,7 @@ import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../../runtime/cluster-creation
|
|
|
20
20
|
import { useC4TwoPhaseUpgradeMockup } from '../../../runtime/use-c4-two-phase-upgrade-mockup.js';
|
|
21
21
|
import { Button, Checkbox, DsText, Link, Modal, Stack } from '../../../ui/index.js';
|
|
22
22
|
import { RadioButton, RadioButtonGroup } from '../../../ui/families.js';
|
|
23
|
-
import {
|
|
23
|
+
import { isMigrationLabel } from '../../../utils/migration-workaround.js';
|
|
24
24
|
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
25
25
|
import { clusterHealthOverride } from '../../cluster-health-override.js';
|
|
26
26
|
import { isClusterReconciliationPaused } from '../../is-cluster-reconciliation-paused.js';
|
|
@@ -58,6 +58,7 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
58
58
|
const [commitAutomatically, setCommitAutomatically] = useState(true);
|
|
59
59
|
const twoPhase = useC4TwoPhaseUpgradeMockup({
|
|
60
60
|
enabled: twoPhaseMockupOn,
|
|
61
|
+
orgId,
|
|
61
62
|
clusterId,
|
|
62
63
|
refreshKey: `${cluster?.generation?.uuid}|${cluster?.status?.ready}`,
|
|
63
64
|
});
|
|
@@ -1364,7 +1365,7 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
1364
1365
|
const tagsValue = [
|
|
1365
1366
|
...(cluster.labels?.camunda ?? []),
|
|
1366
1367
|
...(cluster.labels?.custom ?? []),
|
|
1367
|
-
].filter((value) => typeof value === 'string' && value.length > 0 && !
|
|
1368
|
+
].filter((value) => typeof value === 'string' && value.length > 0 && !isMigrationLabel(value));
|
|
1368
1369
|
const encryptionKeyValue = cluster.primaryEncryptionKeyId && cluster.primaryEncryptionKeyId.length > 0
|
|
1369
1370
|
? cluster.primaryEncryptionKeyId
|
|
1370
1371
|
: cluster.encryption && cluster.encryption !== 'Provider'
|
|
@@ -18,7 +18,8 @@ import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migratio
|
|
|
18
18
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
19
19
|
import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
20
20
|
import { Select, SelectItem } from '../../ui/families.js';
|
|
21
|
-
import {
|
|
21
|
+
import { isMigrationLocked } from '../../utils/migration-view.js';
|
|
22
|
+
import { getMigrationView, isMigrationLabel, isMigrationPlan, } from '../../utils/migration-workaround.js';
|
|
22
23
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
23
24
|
import { clusterHealthOverride } from '../cluster-health-override.js';
|
|
24
25
|
import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
|
|
@@ -140,7 +141,7 @@ function mapClusterToListItem(rawCluster, index) {
|
|
|
140
141
|
? camundaTags.filter((t) => typeof t === 'string')
|
|
141
142
|
: [];
|
|
142
143
|
const customArray = Array.isArray(customTags)
|
|
143
|
-
? customTags.filter((t) => typeof t === 'string' && !
|
|
144
|
+
? customTags.filter((t) => typeof t === 'string' && !isMigrationLabel(t))
|
|
144
145
|
: [];
|
|
145
146
|
const tags = [...camundaArray, ...customArray];
|
|
146
147
|
const currentClusterLoad = getOptionalNumber(rawCluster, 'currentClusterLoad');
|
|
@@ -399,7 +400,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
399
400
|
}, [clusterCapacityMap]);
|
|
400
401
|
const expiryNow = useExpiryClock(rawClusters.some((rawCluster) => getPathString(rawCluster, ['ttl', 'expiresAt']) !== undefined));
|
|
401
402
|
const clusterList = useMemo(() => {
|
|
402
|
-
//
|
|
403
|
+
// A migration cluster has no actions but Delete until it is complete.
|
|
403
404
|
const lockedIds = new Set();
|
|
404
405
|
const tokenClusters = authz.features.console?.clusters;
|
|
405
406
|
const canUpgradeFromToken = (tokenClusters?.canUpgradeGeneration ?? false) ||
|
|
@@ -419,13 +420,13 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
419
420
|
now: expiryNow,
|
|
420
421
|
copy: expiryCopy,
|
|
421
422
|
});
|
|
422
|
-
const
|
|
423
|
-
?
|
|
423
|
+
const migrationView = migrationActive
|
|
424
|
+
? getMigrationView({
|
|
424
425
|
name: mappedItem.name,
|
|
425
426
|
description: getPathString(rawCluster, ['description']),
|
|
426
427
|
})
|
|
427
428
|
: undefined;
|
|
428
|
-
if (
|
|
429
|
+
if (isMigrationLocked(migrationView)) {
|
|
429
430
|
lockedIds.add(mappedItem.id);
|
|
430
431
|
}
|
|
431
432
|
const item = expiry
|
|
@@ -1020,7 +1021,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
1020
1021
|
params: { orgId, clusterId: tagTarget.clusterId },
|
|
1021
1022
|
body: {
|
|
1022
1023
|
labels: {
|
|
1023
|
-
// The
|
|
1024
|
+
// The state of a migration lives in custom labels.
|
|
1024
1025
|
// Send the custom labels again: the PATCH replaces them.
|
|
1025
1026
|
custom: customLabelsOf(rawClusters, tagTarget.clusterId),
|
|
1026
1027
|
camunda: [selectedTag],
|
|
@@ -18,7 +18,7 @@ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console
|
|
|
18
18
|
import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
|
|
19
19
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
20
20
|
import { Link, Stack } from '../../ui/index.js';
|
|
21
|
-
import {
|
|
21
|
+
import { buildMigrationCreateName, isValidAwsRoleArn, MIGRATION_NAME_MAX_LENGTH, MIGRATION_ROLE_ARN_MAX_LENGTH, } from '../../utils/migration-workaround.js';
|
|
22
22
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
23
23
|
/**
|
|
24
24
|
* What the customer types to confirm the delete of the source cluster. It
|
|
@@ -306,7 +306,7 @@ export function buildCreateClusterTranslations(t) {
|
|
|
306
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.'),
|
|
307
307
|
migrationRoleArnMaxLength: translate('createcluster:form.migration.roleArn.validation.maxLength', "The ARN can't be longer than 150 characters."),
|
|
308
308
|
migrationRegionHint: translate('createcluster:form.migration.regionHint', 'Select an AWS region above.'),
|
|
309
|
-
migrationNameMaxLength: translate('createcluster:form.migration.name.validation.maxLength', "Cluster names can't be longer than
|
|
309
|
+
migrationNameMaxLength: translate('createcluster:form.migration.name.validation.maxLength', "Cluster names can't be longer than 33 characters when you migrate."),
|
|
310
310
|
descriptionTitle: translate('createcluster:form.description.title', 'Description (optional)'),
|
|
311
311
|
descriptionPlaceholder: translate('createcluster:form.description.placeholder', 'Enter a description for the cluster'),
|
|
312
312
|
descriptionValidationMaxLength: translate('createcluster:form.description.validation.maxLength', 'Description cannot be longer than 150 characters.'),
|
|
@@ -945,7 +945,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
|
|
|
945
945
|
// the migration until the operator has migration fields.
|
|
946
946
|
const migration = migrationAvailable ? params.migration : undefined;
|
|
947
947
|
const body = {
|
|
948
|
-
name: migration ?
|
|
948
|
+
name: migration ? buildMigrationCreateName(params.name) : params.name,
|
|
949
949
|
planTypeId: params.clusterPlanType,
|
|
950
950
|
...(params.clusterPlan && { clusterPlanId: params.clusterPlan }),
|
|
951
951
|
channelId: params.channel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"react-markdown": "^8.0.7 || ^10.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@camunda/ccma-api": "9.
|
|
89
|
-
"@camunda/ccma-shared-types": "14.
|
|
88
|
+
"@camunda/ccma-api": "9.2.0",
|
|
89
|
+
"@camunda/ccma-shared-types": "14.2.0",
|
|
90
90
|
"@pactsafe/pactsafe-react-sdk": "2.15.0",
|
|
91
91
|
"cron-parser": "5.10.2",
|
|
92
92
|
"mobx": "6.16.1",
|
|
@@ -1,9 +0,0 @@
|
|
|
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): Delete with the operator integration.
|
|
7
|
-
const MAX_BACKUP_ID = BigInt('9223372036854775807');
|
|
8
|
-
/** A backup ID is an integer from 1 to 2^63-1. A string keeps every digit. */
|
|
9
|
-
export const isValidBackupId = (value) => /^[1-9]\d{0,18}$/.test(value) && BigInt(value) <= MAX_BACKUP_ID;
|