@camunda/ccma-saas-frontend 0.26.2 → 0.27.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.
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +11 -6
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +5 -0
- package/lib/esm/components/c4-cluster-migration/backup-id.d.ts +2 -0
- package/lib/esm/components/c4-cluster-migration/backup-id.js +9 -0
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.d.ts +3 -0
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.js +24 -0
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.types.d.ts +23 -0
- package/lib/esm/components/c4-cluster-migration/c4-cluster-migration.types.js +6 -0
- package/lib/esm/components/c4-cluster-migration/migration-translations.d.ts +5 -0
- package/lib/esm/components/c4-cluster-migration/migration-translations.js +21 -0
- package/lib/esm/i18n/en/pages/clusterdetails.json +16 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/utils/migration-workaround.d.ts +19 -0
- package/lib/esm/utils/migration-workaround.js +35 -7
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +96 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +2 -1
- package/lib/esm/widgets/clusters/c4-clusters-page.js +53 -15
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +17 -3
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { C4ClusterListProps } from './c4-cluster-list.types.js';
|
|
3
|
-
export declare const C4ClusterList: ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, onDuplicateCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration, scope, }: C4ClusterListProps) => JSX.Element;
|
|
3
|
+
export declare const C4ClusterList: ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, onDuplicateCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isActionsLocked, isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration, scope, }: C4ClusterListProps) => JSX.Element;
|
|
@@ -27,7 +27,7 @@ function isPlainLeftClick(event) {
|
|
|
27
27
|
!event.ctrlKey &&
|
|
28
28
|
!event.shiftKey);
|
|
29
29
|
}
|
|
30
|
-
export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, onDuplicateCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration, scope = 'cluster', }) => {
|
|
30
|
+
export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, onDuplicateCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isActionsLocked, isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration, scope = 'cluster', }) => {
|
|
31
31
|
const stableClustersRef = useRef(clusters.map((cluster) => ({ ...cluster })));
|
|
32
32
|
const stableClusters = (() => {
|
|
33
33
|
const previousClusters = stableClustersRef.current;
|
|
@@ -182,7 +182,8 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
182
182
|
options: {
|
|
183
183
|
wrapperOptions: {
|
|
184
184
|
wrapper: (row) => {
|
|
185
|
-
const stageTag = row.tags?.length > 0 ? (_jsx(ClusterTag, { stage: row.tags[0] })) : (permissions.canUpdateTag &&
|
|
185
|
+
const stageTag = row.tags?.length > 0 ? (_jsx(ClusterTag, { stage: row.tags[0] })) : (permissions.canUpdateTag &&
|
|
186
|
+
!isActionsLocked?.(row.id) && (_jsx(C4LinkButton, { label: translations.tags.addLabel, onClick: () => onAssignTag(row.id), disabled: !permissions.canUpdateTag, style: { alignSelf: 'center' }, icon: _jsx(Plus, {}) })));
|
|
186
187
|
// A row with no expiry keeps the cell it had before the expiry
|
|
187
188
|
// existed.
|
|
188
189
|
if (!row.expiry) {
|
|
@@ -284,7 +285,9 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
284
285
|
onClick: (row) => onWakeCluster(row.id),
|
|
285
286
|
disabled: (row) => (isFailoverSource?.(row.id) ?? false) ||
|
|
286
287
|
(isOnRetiredAlphaGeneration?.(row.id) ?? false),
|
|
287
|
-
visible: (row) =>
|
|
288
|
+
visible: (row) => !isActionsLocked?.(row.id) &&
|
|
289
|
+
isClusterPaused(row.id) &&
|
|
290
|
+
permissions.canWakeCluster,
|
|
288
291
|
},
|
|
289
292
|
...(onFailoverCluster && isMultiRegionCluster
|
|
290
293
|
? [
|
|
@@ -308,7 +311,8 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
308
311
|
onClick: (row) => onFailoverCluster(row.id),
|
|
309
312
|
disabled: (row) => (isFailoverSource?.(row.id) ?? false) ||
|
|
310
313
|
(isFailoverSyncPending?.(row.id) ?? false),
|
|
311
|
-
visible: (row) => (
|
|
314
|
+
visible: (row) => !isActionsLocked?.(row.id) &&
|
|
315
|
+
(permissions.canFailoverCluster ?? false) &&
|
|
312
316
|
isMultiRegionCluster(row.id),
|
|
313
317
|
},
|
|
314
318
|
]
|
|
@@ -328,7 +332,8 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
328
332
|
kind: 'ghost',
|
|
329
333
|
onClick: (row) => onDuplicateCluster(row.id),
|
|
330
334
|
disabled: (row) => isFailoverSource?.(row.id) ?? false,
|
|
331
|
-
visible: () =>
|
|
335
|
+
visible: (row) => !isActionsLocked?.(row.id) &&
|
|
336
|
+
(permissions.canDuplicateCluster ?? false),
|
|
332
337
|
},
|
|
333
338
|
]
|
|
334
339
|
: []),
|
|
@@ -337,7 +342,7 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
337
342
|
label: translations.overflowMenu.delete,
|
|
338
343
|
kind: 'danger--ghost',
|
|
339
344
|
onClick: (row) => onDeleteCluster(row.id),
|
|
340
|
-
visible: () => permissions.canDeleteCluster,
|
|
345
|
+
visible: (row) => !isActionsLocked?.(row.id) && permissions.canDeleteCluster,
|
|
341
346
|
},
|
|
342
347
|
];
|
|
343
348
|
const renderDataTable = () => {
|
|
@@ -64,6 +64,11 @@ export interface C4ClusterListProps {
|
|
|
64
64
|
onWakeCluster: (clusterId: string) => void;
|
|
65
65
|
onFailoverCluster?: (clusterId: string) => void;
|
|
66
66
|
onDuplicateCluster?: (clusterId: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* True hides every row action of the cluster, and the Add tag link too
|
|
69
|
+
* (migration lock, PDP 3844).
|
|
70
|
+
*/
|
|
71
|
+
isActionsLocked?: (clusterId: string) => boolean;
|
|
67
72
|
trialNotification?: React.ReactNode;
|
|
68
73
|
encryptionNotification?: ClusterListNotification;
|
|
69
74
|
clusterCapMessage?: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import { Button, Checkbox, Stack, TextInput } from '../../ui/index.js';
|
|
9
|
+
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
10
|
+
import { isValidBackupId } from './backup-id.js';
|
|
11
|
+
export function C4ClusterMigration({ state, roleArn, busy = false, canConfirm = true, error, onConfirm, translations: t, }) {
|
|
12
|
+
const [backupId, setBackupId] = useState('');
|
|
13
|
+
const [touched, setTouched] = useState(false);
|
|
14
|
+
const [transferDone, setTransferDone] = useState(false);
|
|
15
|
+
if (state === 'migrating') {
|
|
16
|
+
return (_jsxs(Stack, { gap: 3, "data-testid": 'cluster-migration-migrating', children: [_jsx("h3", { children: t.migratingTitle }), _jsx("p", { children: t.migratingText })] }));
|
|
17
|
+
}
|
|
18
|
+
const idValid = isValidBackupId(backupId);
|
|
19
|
+
const showIdError = touched && !idValid;
|
|
20
|
+
return (_jsxs(Stack, { gap: 5, "data-testid": 'cluster-migration-awaiting', children: [_jsx("h3", { children: t.awaitingTitle }), _jsx("p", { children: t.awaitingInstructions }), roleArn && (_jsxs("p", { children: [t.roleArnLabel, ' ', _jsx("code", { "data-testid": 'cluster-migration-role-arn', children: roleArn })] })), _jsx(TextInput, { id: 'cluster-migration-backup-id', labelText: t.backupIdLabel, value: backupId, invalid: showIdError, invalidText: t.backupIdInvalid, disabled: busy, onChange: (event) => {
|
|
21
|
+
setTouched(true);
|
|
22
|
+
setBackupId(event.target.value.trim());
|
|
23
|
+
} }), _jsx(Checkbox, { id: 'cluster-migration-transfer-done', labelText: t.transferDoneLabel, checked: transferDone, disabled: busy, onChange: (event) => setTransferDone(event.target.checked) }), _jsx(C4InlineNotification, { kind: 'warning', title: '', subtitle: t.restoreWarning, hideCloseButton: true }), error && (_jsx(C4InlineNotification, { kind: 'error', title: '', subtitle: error, hideCloseButton: true })), _jsx("div", { children: _jsx(Button, { disabled: busy || !canConfirm || !idValid || !transferDone, onClick: () => onConfirm(backupId), children: t.confirmButton }) })] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface C4ClusterMigrationTranslations {
|
|
2
|
+
awaitingTitle: string;
|
|
3
|
+
awaitingInstructions: string;
|
|
4
|
+
roleArnLabel: string;
|
|
5
|
+
backupIdLabel: string;
|
|
6
|
+
backupIdInvalid: string;
|
|
7
|
+
transferDoneLabel: string;
|
|
8
|
+
restoreWarning: string;
|
|
9
|
+
confirmButton: string;
|
|
10
|
+
migratingTitle: string;
|
|
11
|
+
migratingText: string;
|
|
12
|
+
}
|
|
13
|
+
export interface C4ClusterMigrationProps {
|
|
14
|
+
state: 'awaitingTransfer' | 'migrating';
|
|
15
|
+
roleArn?: string;
|
|
16
|
+
busy?: boolean;
|
|
17
|
+
/** False for a member without the right to update the cluster. */
|
|
18
|
+
canConfirm?: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
/** Gets the backup ID as a string, because a number loses digits. */
|
|
21
|
+
onConfirm: (backupId: string) => void;
|
|
22
|
+
translations: C4ClusterMigrationTranslations;
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
2
|
+
import type { C4ClusterMigrationTranslations } from './c4-cluster-migration.types.js';
|
|
3
|
+
type T = Parameters<typeof safeTranslate>[0];
|
|
4
|
+
export declare const buildMigrationTranslations: (t: T) => C4ClusterMigrationTranslations;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
7
|
+
// TODO(3844-workaround): The English text lives in
|
|
8
|
+
// `i18n/en/pages/clusterdetails.json`. The defaults here keep a host without
|
|
9
|
+
// the c4 catalog readable.
|
|
10
|
+
export const buildMigrationTranslations = (t) => ({
|
|
11
|
+
awaitingTitle: safeTranslate(t, 'clusterdetails:migration.awaiting.title', 'Transfer your data'),
|
|
12
|
+
awaitingInstructions: safeTranslate(t, 'clusterdetails:migration.awaiting.instructions', 'Copy your Self-Managed backup to the storage that Camunda reads. Let the IAM role below access it. Then enter the backup ID and confirm.'),
|
|
13
|
+
roleArnLabel: safeTranslate(t, 'clusterdetails:migration.awaiting.roleArn', 'IAM role:'),
|
|
14
|
+
backupIdLabel: safeTranslate(t, 'clusterdetails:migration.awaiting.backupId', 'Backup ID'),
|
|
15
|
+
backupIdInvalid: safeTranslate(t, 'clusterdetails:migration.awaiting.backupIdInvalid', 'Enter a whole number from 1 to 9223372036854775807.'),
|
|
16
|
+
transferDoneLabel: safeTranslate(t, 'clusterdetails:migration.awaiting.transferDone', 'I copied the backup'),
|
|
17
|
+
restoreWarning: safeTranslate(t, 'clusterdetails:migration.awaiting.warning', 'The restore replaces all existing data in this cluster.'),
|
|
18
|
+
confirmButton: safeTranslate(t, 'clusterdetails:migration.awaiting.confirm', 'Start migration'),
|
|
19
|
+
migratingTitle: safeTranslate(t, 'clusterdetails:migration.migrating.title', 'Migration in progress'),
|
|
20
|
+
migratingText: safeTranslate(t, 'clusterdetails:migration.migrating.text', 'Camunda restores your backup. This cluster has no actions until the migration ends.'),
|
|
21
|
+
});
|
|
@@ -771,5 +771,21 @@
|
|
|
771
771
|
"failed": "Not completed",
|
|
772
772
|
"created": "Created"
|
|
773
773
|
}
|
|
774
|
+
},
|
|
775
|
+
"migration": {
|
|
776
|
+
"awaiting": {
|
|
777
|
+
"title": "Transfer your data",
|
|
778
|
+
"instructions": "Copy your Self-Managed backup to the storage that Camunda reads. Let the IAM role below access it. Then enter the backup ID and confirm.",
|
|
779
|
+
"roleArn": "IAM role:",
|
|
780
|
+
"backupId": "Backup ID",
|
|
781
|
+
"backupIdInvalid": "Enter a whole number from 1 to 9223372036854775807.",
|
|
782
|
+
"transferDone": "I copied the backup",
|
|
783
|
+
"warning": "The restore replaces all existing data in this cluster.",
|
|
784
|
+
"confirm": "Start migration"
|
|
785
|
+
},
|
|
786
|
+
"migrating": {
|
|
787
|
+
"title": "Migration in progress",
|
|
788
|
+
"text": "Camunda restores your backup. This cluster has no actions until the migration ends."
|
|
789
|
+
}
|
|
774
790
|
}
|
|
775
791
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export { C4ClusterExpiryTag } from './components/c4-cluster-list/c4-cluster-expi
|
|
|
56
56
|
export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
|
|
57
57
|
export type { C4ClusterListProps, ClusterListItem, ClusterListNotification, ClusterListPermissions, ClusterListUrls, } from './components/c4-cluster-list/c4-cluster-list.types.js';
|
|
58
58
|
export { type ClusterExpiryRemaining, type ClusterExpiryTag, type ClusterExpiryTagCopy, DEFAULT_CLUSTER_EXPIRY_TAG_COPY, getClusterExpiryRemaining, getClusterExpiryTag, } from './components/c4-cluster-list/cluster-expiry-tag.js';
|
|
59
|
+
export { C4ClusterMigration } from './components/c4-cluster-migration/c4-cluster-migration.js';
|
|
60
|
+
export type { C4ClusterMigrationProps, C4ClusterMigrationTranslations, } from './components/c4-cluster-migration/c4-cluster-migration.types.js';
|
|
59
61
|
export type { ApplicationsProps, ApplicationTileProps, ClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
60
62
|
export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
61
63
|
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export { C4ClusterDetailsSecureConnectivity } from './components/c4-cluster-deta
|
|
|
32
32
|
export { C4ClusterExpiryTag } from './components/c4-cluster-list/c4-cluster-expiry-tag.js';
|
|
33
33
|
export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
|
|
34
34
|
export { DEFAULT_CLUSTER_EXPIRY_TAG_COPY, getClusterExpiryRemaining, getClusterExpiryTag, } from './components/c4-cluster-list/cluster-expiry-tag.js';
|
|
35
|
+
export { C4ClusterMigration } from './components/c4-cluster-migration/c4-cluster-migration.js';
|
|
35
36
|
export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
36
37
|
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
37
38
|
export { C4ClusterSettings } from './components/c4-cluster-settings/c4-cluster-settings.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ClusterLabels } from '@camunda/ccma-shared-types';
|
|
1
2
|
/** The cloud identity that the customer lets Camunda use for the transfer. */
|
|
2
3
|
export type MigrationIdentity = {
|
|
3
4
|
provider: 'aws';
|
|
@@ -11,10 +12,28 @@ export interface MigrationInfo {
|
|
|
11
12
|
/** The name without the prefix. */
|
|
12
13
|
displayName: string;
|
|
13
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* A cluster is in a state only if the name has the prefix AND the description
|
|
17
|
+
* is a valid role ARN. A user who renames a cluster to "[3844 start] X" has
|
|
18
|
+
* no ARN, so the rename does not lock the cluster.
|
|
19
|
+
*/
|
|
14
20
|
export declare const getMigrationInfo: (cluster: {
|
|
15
21
|
name: string;
|
|
16
22
|
description?: string;
|
|
17
23
|
}) => MigrationInfo;
|
|
24
|
+
/**
|
|
25
|
+
* The one plan check of the details page, the list and the dashboard. An
|
|
26
|
+
* unknown plan (slow or failed org request) keeps a prefixed cluster locked.
|
|
27
|
+
* Only a known other plan unlocks it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const isMigrationPlan: (planType: string | undefined) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The backup ID has no field in the operator yet. Ops read it from the custom
|
|
32
|
+
* labels of the cluster. The new label replaces an older one.
|
|
33
|
+
*/
|
|
34
|
+
export declare const withBackupIdLabel: (labels: ClusterLabels | undefined, backupId: string) => Required<ClusterLabels>;
|
|
35
|
+
/** True for the label that holds the backup ID. The UI shows no such label. */
|
|
36
|
+
export declare const isBackupIdLabel: (label: string) => boolean;
|
|
18
37
|
export declare const buildStartName: (name: string) => string;
|
|
19
38
|
export declare const buildMigrateName: (name: string) => string;
|
|
20
39
|
/** The name limit while the prefix takes room in the 50 character name. */
|
|
@@ -3,27 +3,55 @@
|
|
|
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 { MIGRATION_BACKUP_ID_LABEL_PREFIX, SalesPlanType, } from '@camunda/ccma-shared-types';
|
|
6
7
|
// TODO(3844-workaround): The operator has no migration fields yet. The name
|
|
7
8
|
// prefix holds the state and the description holds the role. Delete this file
|
|
8
9
|
// when the operator spec is ready. Only this file knows the prefixes.
|
|
9
10
|
const START_PREFIX = '[3844 start] ';
|
|
10
11
|
const MIGRATE_PREFIX = '[3844 migrate] ';
|
|
12
|
+
/**
|
|
13
|
+
* A cluster is in a state only if the name has the prefix AND the description
|
|
14
|
+
* is a valid role ARN. A user who renames a cluster to "[3844 start] X" has
|
|
15
|
+
* no ARN, so the rename does not lock the cluster.
|
|
16
|
+
*/
|
|
11
17
|
export const getMigrationInfo = (cluster) => {
|
|
12
18
|
const prefixes = [
|
|
13
19
|
[START_PREFIX, 'awaitingTransfer'],
|
|
14
20
|
[MIGRATE_PREFIX, 'migrating'],
|
|
15
21
|
];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const roleArn = cluster.description ?? '';
|
|
23
|
+
if (isValidAwsRoleArn(roleArn)) {
|
|
24
|
+
for (const [prefix, state] of prefixes) {
|
|
25
|
+
if (cluster.name.startsWith(prefix)) {
|
|
26
|
+
return {
|
|
27
|
+
state,
|
|
28
|
+
roleArn,
|
|
29
|
+
displayName: cluster.name.slice(prefix.length),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
return { state: 'none', displayName: cluster.name };
|
|
26
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* The one plan check of the details page, the list and the dashboard. An
|
|
38
|
+
* unknown plan (slow or failed org request) keeps a prefixed cluster locked.
|
|
39
|
+
* Only a known other plan unlocks it.
|
|
40
|
+
*/
|
|
41
|
+
export const isMigrationPlan = (planType) => !planType || planType === SalesPlanType.ENTERPRISE;
|
|
42
|
+
/**
|
|
43
|
+
* The backup ID has no field in the operator yet. Ops read it from the custom
|
|
44
|
+
* labels of the cluster. The new label replaces an older one.
|
|
45
|
+
*/
|
|
46
|
+
export const withBackupIdLabel = (labels, backupId) => ({
|
|
47
|
+
camunda: [...(labels?.camunda ?? [])],
|
|
48
|
+
custom: [
|
|
49
|
+
...(labels?.custom ?? []).filter((label) => !label.startsWith(MIGRATION_BACKUP_ID_LABEL_PREFIX)),
|
|
50
|
+
MIGRATION_BACKUP_ID_LABEL_PREFIX + backupId,
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
/** True for the label that holds the backup ID. The UI shows no such label. */
|
|
54
|
+
export const isBackupIdLabel = (label) => label.startsWith(MIGRATION_BACKUP_ID_LABEL_PREFIX);
|
|
27
55
|
export const buildStartName = (name) => START_PREFIX + name;
|
|
28
56
|
export const buildMigrateName = (name) => MIGRATE_PREFIX + name;
|
|
29
57
|
/** The name limit while the prefix takes room in the 50 character name. */
|
|
@@ -5,17 +5,21 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
7
|
import { AuditLoggerService, ConsoleAlertsService, ConsoleByomMonitoringService, ConsoleClusterParametersService, ConsoleClusterService, GenerationService, HdpService, HttpError, SaaSJobsService, } from '@camunda/ccma-api';
|
|
8
|
-
import { AUDIT_LOG_TAB_MIN_VERSION, CLUSTER_STATISTICS_CONFIG_MIN_VERSION, checkVersion, deriveEncryptionStatus, deriveSecondaryStorageStatus, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
8
|
+
import { AUDIT_LOG_TAB_MIN_VERSION, CLUSTER_STATISTICS_CONFIG_MIN_VERSION, checkVersion, deriveEncryptionStatus, deriveSecondaryStorageStatus, SalesPlanType, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
9
9
|
import { observer } from 'mobx-react-lite';
|
|
10
10
|
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
11
|
+
import { C4ClusterMigration } from '../../components/c4-cluster-migration/c4-cluster-migration.js';
|
|
12
|
+
import { buildMigrationTranslations } from '../../components/c4-cluster-migration/migration-translations.js';
|
|
11
13
|
import { normalizeClusterStatus } from '../../components/c4-cluster-overview/applications.js';
|
|
12
14
|
import { getC4ClusterDetailsUrls } from '../../externalUrls.const.js';
|
|
13
15
|
import { isDeveloperBlockedFromClusterCreate, useC4ConsoleAuthz, } from '../../runtime/c4-console-authz.js';
|
|
14
16
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
15
17
|
import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
|
|
16
18
|
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-blocked.js';
|
|
19
|
+
import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
|
|
17
20
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
18
21
|
import { Modal, Stack, TextInput } from '../../ui/index.js';
|
|
22
|
+
import { buildMigrateName, getMigrationInfo, isMigrationPlan, withBackupIdLabel, } from '../../utils/migration-workaround.js';
|
|
19
23
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
20
24
|
import { clusterHealthOverride } from '../cluster-health-override.js';
|
|
21
25
|
import { useClusterApiClients } from '../environment/use-cluster-api-clients.js';
|
|
@@ -526,8 +530,34 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
526
530
|
cluster?.status?.zeebeRestUrl,
|
|
527
531
|
reloadStatisticsConfig,
|
|
528
532
|
]);
|
|
529
|
-
|
|
530
|
-
const
|
|
533
|
+
// TODO(3844-workaround): The state comes from the name prefix.
|
|
534
|
+
const migrationFlagOn = useC4FeatureFlag(SELF_MANAGED_MIGRATION_FLAG);
|
|
535
|
+
const migrationOrgInfo = data.getOrgInfo(props.orgId);
|
|
536
|
+
// An unknown plan (slow or failed org request) keeps a prefixed cluster
|
|
537
|
+
// locked. Only a known other plan unlocks it.
|
|
538
|
+
const migrationPlanType = migrationOrgInfo?.organizationToSalesPlan?.salesPlan?.salesPlanType;
|
|
539
|
+
const clusterName = cluster?.name;
|
|
540
|
+
const clusterDescription = cluster?.description;
|
|
541
|
+
// Memoized, so that `onConfirmMigration` and the tabs keep their identity
|
|
542
|
+
// between renders.
|
|
543
|
+
const migrationInfo = useMemo(() => migrationFlagOn &&
|
|
544
|
+
isMigrationPlan(migrationPlanType) &&
|
|
545
|
+
clusterName !== undefined
|
|
546
|
+
? getMigrationInfo({
|
|
547
|
+
name: clusterName,
|
|
548
|
+
description: clusterDescription,
|
|
549
|
+
})
|
|
550
|
+
: undefined, [migrationFlagOn, migrationPlanType, clusterName, clusterDescription]);
|
|
551
|
+
const migrationState = migrationInfo && migrationInfo.state !== 'none'
|
|
552
|
+
? migrationInfo.state
|
|
553
|
+
: undefined;
|
|
554
|
+
const migrationLocked = migrationState !== undefined;
|
|
555
|
+
// Only a known Enterprise plan may submit. An unknown plan keeps the lock
|
|
556
|
+
// but never confirms.
|
|
557
|
+
const migrationCanConfirm = migrationPlanType === SalesPlanType.ENTERPRISE &&
|
|
558
|
+
Boolean(authz.visibilities.clusters?.canEdit);
|
|
559
|
+
const canRename = !migrationLocked && Boolean(authz.visibilities.clusters?.canEdit);
|
|
560
|
+
const canDelete = !migrationLocked && Boolean(authz.visibilities.clusters?.canDelete);
|
|
531
561
|
const { hasIdentityIntegration, useClusterSecretsLabel } = useClusterVersionFlags(cluster);
|
|
532
562
|
const [dismissedFailedRestores, setDismissedFailedRestores] = useState(loadDismissedFailedRestores);
|
|
533
563
|
const dismissFailedRestore = useCallback((restoreId) => {
|
|
@@ -614,6 +644,39 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
614
644
|
setClusterMutationError('');
|
|
615
645
|
}
|
|
616
646
|
}, [deleteOpen]);
|
|
647
|
+
// TODO(3844-workaround): The backup ID has no field yet. The PATCH stores
|
|
648
|
+
// it in the custom labels, where ops read it.
|
|
649
|
+
const onConfirmMigration = useCallback(async (backupId) => {
|
|
650
|
+
if (!migrationInfo || !migrationCanConfirm)
|
|
651
|
+
return;
|
|
652
|
+
setClusterMutationBusy(true);
|
|
653
|
+
setClusterMutationError('');
|
|
654
|
+
try {
|
|
655
|
+
await ConsoleClusterService.updateCluster({
|
|
656
|
+
config: apiConfig,
|
|
657
|
+
params: { orgId: props.orgId, clusterId: props.clusterId },
|
|
658
|
+
body: {
|
|
659
|
+
name: buildMigrateName(migrationInfo.displayName),
|
|
660
|
+
labels: withBackupIdLabel(cluster?.labels, backupId),
|
|
661
|
+
},
|
|
662
|
+
});
|
|
663
|
+
await reloadCluster();
|
|
664
|
+
}
|
|
665
|
+
catch (error) {
|
|
666
|
+
setClusterMutationError(error instanceof Error ? error.message : 'Failed');
|
|
667
|
+
}
|
|
668
|
+
finally {
|
|
669
|
+
setClusterMutationBusy(false);
|
|
670
|
+
}
|
|
671
|
+
}, [
|
|
672
|
+
apiConfig,
|
|
673
|
+
props.orgId,
|
|
674
|
+
props.clusterId,
|
|
675
|
+
migrationInfo,
|
|
676
|
+
migrationCanConfirm,
|
|
677
|
+
cluster?.labels,
|
|
678
|
+
reloadCluster,
|
|
679
|
+
]);
|
|
617
680
|
const onRename = async () => {
|
|
618
681
|
setClusterMutationBusy(true);
|
|
619
682
|
setClusterMutationError('');
|
|
@@ -1057,7 +1120,8 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1057
1120
|
true,
|
|
1058
1121
|
orgRoles: authz.orgRoles,
|
|
1059
1122
|
});
|
|
1060
|
-
const canDuplicate =
|
|
1123
|
+
const canDuplicate = !migrationLocked &&
|
|
1124
|
+
Boolean(authz.visibilities.clusters?.canCreate) &&
|
|
1061
1125
|
!clusterCreationBlocked &&
|
|
1062
1126
|
!developerBlockedFromClusterCreate &&
|
|
1063
1127
|
cluster?.isFailoverSource !== true;
|
|
@@ -1494,6 +1558,19 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1494
1558
|
init: () => { },
|
|
1495
1559
|
},
|
|
1496
1560
|
];
|
|
1561
|
+
// TODO(3844-workaround): A locked cluster shows only the migration panel.
|
|
1562
|
+
if (migrationState) {
|
|
1563
|
+
return [
|
|
1564
|
+
{
|
|
1565
|
+
id: 'overview',
|
|
1566
|
+
label: tabLabel('overview'),
|
|
1567
|
+
component: (_jsx(C4ClusterMigration, { state: migrationState, roleArn: migrationInfo?.roleArn, busy: clusterMutationBusy, canConfirm: migrationCanConfirm, error: clusterMutationError, onConfirm: (backupId) => {
|
|
1568
|
+
void onConfirmMigration(backupId);
|
|
1569
|
+
}, translations: buildMigrationTranslations(t) })),
|
|
1570
|
+
visible: true,
|
|
1571
|
+
},
|
|
1572
|
+
];
|
|
1573
|
+
}
|
|
1497
1574
|
return base
|
|
1498
1575
|
.filter((tab) => tab.visible !== false)
|
|
1499
1576
|
.map((tab) => ({
|
|
@@ -1504,6 +1581,12 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1504
1581
|
initializeTab: tab.id === activeTabId ? tab.init : undefined,
|
|
1505
1582
|
}));
|
|
1506
1583
|
}, [
|
|
1584
|
+
migrationState,
|
|
1585
|
+
migrationCanConfirm,
|
|
1586
|
+
migrationInfo?.roleArn,
|
|
1587
|
+
onConfirmMigration,
|
|
1588
|
+
clusterMutationBusy,
|
|
1589
|
+
clusterMutationError,
|
|
1507
1590
|
activeTabId,
|
|
1508
1591
|
activityComponent,
|
|
1509
1592
|
alertsComponent,
|
|
@@ -1599,7 +1682,14 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1599
1682
|
// primaryBanner takes priority — an active restore, an unmaintained
|
|
1600
1683
|
// generation, or disabled authorizations all matter more than a
|
|
1601
1684
|
// one-time "update your endpoint" nudge.
|
|
1602
|
-
|
|
1685
|
+
// A locked cluster shows no banner, because its actions are locked. The
|
|
1686
|
+
// restore banners stay: they only report.
|
|
1687
|
+
const banner = migrationLocked
|
|
1688
|
+
? primaryBanner?.kind === 'restoreFailed' ||
|
|
1689
|
+
primaryBanner?.kind === 'restoreInProgress'
|
|
1690
|
+
? primaryBanner
|
|
1691
|
+
: undefined
|
|
1692
|
+
: (primaryBanner ?? failoverUriBanner);
|
|
1603
1693
|
// Shared by the tab strip's onChange and the secondary-replication
|
|
1604
1694
|
// header indicator's click action — both switch to a tab the same way.
|
|
1605
1695
|
const handleTabChange = (tabId) => {
|
|
@@ -1629,7 +1719,7 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1629
1719
|
// a change must not unmount the tabs, or an open editor loses its
|
|
1630
1720
|
// draft and the page moves under the pointer.
|
|
1631
1721
|
loading: (isClusterLoading && cluster?.uuid !== props.clusterId) ||
|
|
1632
|
-
authz.isLoading, padding: props.padding, clusterName: cluster?.name, phaseTag: headerPhaseTag, healthStatus: headerHealthStatus, versionLabel: headerVersionLabel, regionCode: headerRegionCode, isDevelopmentPlan: cluster?.planType?.development, urls: { clusters: urls.clusters }, onNavigateToClusters: () => props.onNavigate?.({ kind: 'clusters', orgId: props.orgId }), menu: {
|
|
1722
|
+
authz.isLoading, padding: props.padding, clusterName: migrationInfo?.displayName ?? cluster?.name, phaseTag: headerPhaseTag, healthStatus: headerHealthStatus, versionLabel: headerVersionLabel, regionCode: headerRegionCode, isDevelopmentPlan: cluster?.planType?.development, urls: { clusters: urls.clusters }, onNavigateToClusters: () => props.onNavigate?.({ kind: 'clusters', orgId: props.orgId }), menu: {
|
|
1633
1723
|
canRename,
|
|
1634
1724
|
canDelete,
|
|
1635
1725
|
canDuplicate,
|
|
@@ -18,6 +18,7 @@ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../../runtime/c4-cons
|
|
|
18
18
|
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../../runtime/cluster-creation-blocked.js';
|
|
19
19
|
import { Button, Checkbox, DsText, Link, Modal, Stack } from '../../../ui/index.js';
|
|
20
20
|
import { RadioButton, RadioButtonGroup } from '../../../ui/families.js';
|
|
21
|
+
import { isBackupIdLabel } from '../../../utils/migration-workaround.js';
|
|
21
22
|
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
22
23
|
import { clusterHealthOverride } from '../../cluster-health-override.js';
|
|
23
24
|
import { isClusterReconciliationPaused } from '../../is-cluster-reconciliation-paused.js';
|
|
@@ -1337,7 +1338,7 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
1337
1338
|
const tagsValue = [
|
|
1338
1339
|
...(cluster.labels?.camunda ?? []),
|
|
1339
1340
|
...(cluster.labels?.custom ?? []),
|
|
1340
|
-
].filter((value) => typeof value === 'string' && value.length > 0);
|
|
1341
|
+
].filter((value) => typeof value === 'string' && value.length > 0 && !isBackupIdLabel(value));
|
|
1341
1342
|
const encryptionKeyValue = cluster.primaryEncryptionKeyId && cluster.primaryEncryptionKeyId.length > 0
|
|
1342
1343
|
? cluster.primaryEncryptionKeyId
|
|
1343
1344
|
: cluster.encryption && cluster.encryption !== 'Provider'
|
|
@@ -14,9 +14,11 @@ import { hasAvailableClusterReservation, isDeveloperBlockedFromClusterCreate, us
|
|
|
14
14
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
15
15
|
import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
|
|
16
16
|
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-blocked.js';
|
|
17
|
+
import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
|
|
17
18
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
18
19
|
import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
|
|
19
20
|
import { Select, SelectItem } from '../../ui/families.js';
|
|
21
|
+
import { getMigrationInfo, isBackupIdLabel, isMigrationPlan, } from '../../utils/migration-workaround.js';
|
|
20
22
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
21
23
|
import { clusterHealthOverride } from '../cluster-health-override.js';
|
|
22
24
|
import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
|
|
@@ -94,11 +96,23 @@ function isGenerationMatching(rawCluster) {
|
|
|
94
96
|
}
|
|
95
97
|
return generationUuid === currentGenerationUuid;
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
// The one ID priority of the list rows. The Add tag modal and the failover
|
|
100
|
+
// set must find the same ID as `row.id`.
|
|
101
|
+
function getRawClusterId(rawCluster) {
|
|
102
|
+
return (getString(rawCluster, 'id') ??
|
|
99
103
|
getString(rawCluster, 'clusterId') ??
|
|
100
104
|
getString(rawCluster, 'uuid') ??
|
|
101
|
-
getString(rawCluster, 'clusterUuid');
|
|
105
|
+
getString(rawCluster, 'clusterUuid'));
|
|
106
|
+
}
|
|
107
|
+
function customLabelsOf(rawClusters, clusterId) {
|
|
108
|
+
const raw = rawClusters.find((rawCluster) => getRawClusterId(rawCluster) === clusterId);
|
|
109
|
+
const custom = raw?.labels?.custom;
|
|
110
|
+
return Array.isArray(custom)
|
|
111
|
+
? custom.filter((label) => typeof label === 'string')
|
|
112
|
+
: [];
|
|
113
|
+
}
|
|
114
|
+
function mapClusterToListItem(rawCluster, index) {
|
|
115
|
+
const id = getRawClusterId(rawCluster);
|
|
102
116
|
if (!id) {
|
|
103
117
|
return undefined;
|
|
104
118
|
}
|
|
@@ -126,7 +140,7 @@ function mapClusterToListItem(rawCluster, index) {
|
|
|
126
140
|
? camundaTags.filter((t) => typeof t === 'string')
|
|
127
141
|
: [];
|
|
128
142
|
const customArray = Array.isArray(customTags)
|
|
129
|
-
? customTags.filter((t) => typeof t === 'string')
|
|
143
|
+
? customTags.filter((t) => typeof t === 'string' && !isBackupIdLabel(t))
|
|
130
144
|
: [];
|
|
131
145
|
const tags = [...camundaArray, ...customArray];
|
|
132
146
|
const currentClusterLoad = getOptionalNumber(rawCluster, 'currentClusterLoad');
|
|
@@ -346,6 +360,12 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
346
360
|
const clustersCache = data.clusters[orgId];
|
|
347
361
|
const clusterCapacityMap = data.clusterCapacity[orgId] ?? new Map();
|
|
348
362
|
const orgInfo = data.getOrgInfo(orgId);
|
|
363
|
+
// TODO(3844-workaround): The state comes from the name prefix.
|
|
364
|
+
const migrationFlagOn = useC4FeatureFlag(SELF_MANAGED_MIGRATION_FLAG);
|
|
365
|
+
// An unknown plan (slow or failed org request) keeps a prefixed cluster
|
|
366
|
+
// locked. Only a known other plan unlocks it.
|
|
367
|
+
const migrationPlanType = getPathString((orgInfo ?? {}), ['organizationToSalesPlan', 'salesPlan', 'salesPlanType']);
|
|
368
|
+
const migrationActive = migrationFlagOn && isMigrationPlan(migrationPlanType);
|
|
349
369
|
const rawClusters = (clustersCache?.data ?? []);
|
|
350
370
|
// A missing entry is "not fetched yet", not "fetched and empty": an effect
|
|
351
371
|
// starts the fetch, so it can begin after the first render.
|
|
@@ -378,14 +398,16 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
378
398
|
return clusterCapacityMap;
|
|
379
399
|
}, [clusterCapacityMap]);
|
|
380
400
|
const expiryNow = useExpiryClock(rawClusters.some((rawCluster) => getPathString(rawCluster, ['ttl', 'expiresAt']) !== undefined));
|
|
381
|
-
const
|
|
401
|
+
const clusterList = useMemo(() => {
|
|
402
|
+
// TODO(3844-workaround): A cluster in a migration state has no actions.
|
|
403
|
+
const lockedIds = new Set();
|
|
382
404
|
const tokenClusters = authz.features.console?.clusters;
|
|
383
405
|
const canUpgradeFromToken = (tokenClusters?.canUpgradeGeneration ?? false) ||
|
|
384
406
|
(tokenClusters?.canUpgradeGenerationYolo ?? false);
|
|
385
407
|
const canUpgradeGeneration = isOrgAdmin || canUpgradeFromToken;
|
|
386
408
|
const updateSuffix = safeTranslate(runtime.i18n?.t, 'c4console:clusters.list.updateAvailableSuffix', ' - update available');
|
|
387
409
|
const expiryCopy = translations?.tags.expiry ?? buildClusterExpiryTagCopy(runtime.i18n?.t);
|
|
388
|
-
|
|
410
|
+
const items = rawClusters
|
|
389
411
|
.map((rawCluster, index) => {
|
|
390
412
|
const mappedItem = mapClusterToListItem(rawCluster, index);
|
|
391
413
|
if (!mappedItem)
|
|
@@ -397,9 +419,19 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
397
419
|
now: expiryNow,
|
|
398
420
|
copy: expiryCopy,
|
|
399
421
|
});
|
|
400
|
-
const
|
|
401
|
-
? {
|
|
422
|
+
const migrationInfo = migrationActive
|
|
423
|
+
? getMigrationInfo({
|
|
424
|
+
name: mappedItem.name,
|
|
425
|
+
description: getPathString(rawCluster, ['description']),
|
|
426
|
+
})
|
|
427
|
+
: undefined;
|
|
428
|
+
if (migrationInfo && migrationInfo.state !== 'none') {
|
|
429
|
+
lockedIds.add(mappedItem.id);
|
|
430
|
+
}
|
|
431
|
+
const named = migrationInfo
|
|
432
|
+
? { ...mappedItem, name: migrationInfo.displayName }
|
|
402
433
|
: mappedItem;
|
|
434
|
+
const item = expiry ? { ...named, expiry } : named;
|
|
403
435
|
// A restoring or reconciliation-paused cluster reports a raw status
|
|
404
436
|
// that says nothing useful. `clusterHealthOverride` owns the label
|
|
405
437
|
// that replaces it. This list, the header badge of the cluster page,
|
|
@@ -440,6 +472,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
440
472
|
return clusterWithLoad;
|
|
441
473
|
})
|
|
442
474
|
.filter((item) => Boolean(item));
|
|
475
|
+
return { items, lockedIds };
|
|
443
476
|
}, [
|
|
444
477
|
authz,
|
|
445
478
|
clusterLoadData,
|
|
@@ -447,11 +480,14 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
447
480
|
generationToClusterId,
|
|
448
481
|
expiryNow,
|
|
449
482
|
isOrgAdmin,
|
|
483
|
+
migrationActive,
|
|
450
484
|
rawClusters,
|
|
451
485
|
runtime.i18n,
|
|
452
486
|
translations,
|
|
453
487
|
upgradableGenerationsCache,
|
|
454
488
|
]);
|
|
489
|
+
const clusters = clusterList.items;
|
|
490
|
+
const migrationLockedIds = clusterList.lockedIds;
|
|
455
491
|
const clusterById = useMemo(() => {
|
|
456
492
|
const map = new Map();
|
|
457
493
|
for (const cluster of clusters) {
|
|
@@ -734,7 +770,9 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
734
770
|
setDeleteConfirmation('');
|
|
735
771
|
setDeleteError(undefined);
|
|
736
772
|
setDeleteModalOpen(true);
|
|
737
|
-
runtime.telemetry?.track?.('c4Clusters.delete.requested', {
|
|
773
|
+
runtime.telemetry?.track?.('c4Clusters.delete.requested', {
|
|
774
|
+
clusterId,
|
|
775
|
+
});
|
|
738
776
|
}
|
|
739
777
|
};
|
|
740
778
|
const handleAssignTag = (clusterId) => {
|
|
@@ -897,16 +935,14 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
897
935
|
for (const rawCluster of rawClusters) {
|
|
898
936
|
if (rawCluster.isFailoverSource !== true)
|
|
899
937
|
continue;
|
|
900
|
-
const clusterId =
|
|
901
|
-
getString(rawCluster, 'clusterId') ??
|
|
902
|
-
getString(rawCluster, 'uuid') ??
|
|
903
|
-
getString(rawCluster, 'clusterUuid');
|
|
938
|
+
const clusterId = getRawClusterId(rawCluster);
|
|
904
939
|
if (clusterId)
|
|
905
940
|
ids.add(clusterId);
|
|
906
941
|
}
|
|
907
942
|
return ids;
|
|
908
943
|
}, [rawClusters]);
|
|
909
944
|
const isFailoverSource = useCallback((clusterId) => failoverSourceClusterIds.has(clusterId), [failoverSourceClusterIds]);
|
|
945
|
+
const isActionsLocked = useCallback((clusterId) => migrationLockedIds.has(clusterId), [migrationLockedIds]);
|
|
910
946
|
const retiredAlphaClusterIds = useMemo(() => {
|
|
911
947
|
const ids = new Set();
|
|
912
948
|
for (const rawCluster of rawClusters) {
|
|
@@ -935,7 +971,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
935
971
|
orgId,
|
|
936
972
|
});
|
|
937
973
|
}, [error, orgId, runtime.telemetry]);
|
|
938
|
-
return (_jsxs(_Fragment, { children: [_jsx(C4ClusterList, { orgId: orgId, scope: scope, clusters: clusters, loading: isPageLoading, urls: urls, permissions: derivedPermissions, onNavigate: handleNavigate, onDeleteCluster: handleDeleteCluster, onAssignTag: handleAssignTag, onWakeCluster: handleWakeCluster, onFailoverCluster: handleFailoverCluster, onDuplicateCluster: handleDuplicateCluster, trialNotification: derivedTrialNotification, encryptionNotification: encryptionNotification, clusterCapMessage: clusterCapMessage, emptyStateContent: derivedEmptyStateContent, translations: resolvedTranslations, isClusterPaused: isClusterPausedOverride ?? isClusterPausedFallback, isMultiRegionCluster: isMultiRegionClusterFallback, isFailoverSyncPending: isFailoverSyncPending, isFailoverSource: isFailoverSource, isOnRetiredAlphaGeneration: isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration: isRunningOnUnsupportedGenerationOverride ??
|
|
974
|
+
return (_jsxs(_Fragment, { children: [_jsx(C4ClusterList, { orgId: orgId, scope: scope, clusters: clusters, loading: isPageLoading, urls: urls, permissions: derivedPermissions, onNavigate: handleNavigate, onDeleteCluster: handleDeleteCluster, onAssignTag: handleAssignTag, onWakeCluster: handleWakeCluster, onFailoverCluster: handleFailoverCluster, onDuplicateCluster: handleDuplicateCluster, trialNotification: derivedTrialNotification, encryptionNotification: encryptionNotification, clusterCapMessage: clusterCapMessage, emptyStateContent: derivedEmptyStateContent, translations: resolvedTranslations, isClusterPaused: isClusterPausedOverride ?? isClusterPausedFallback, isMultiRegionCluster: isMultiRegionClusterFallback, isFailoverSyncPending: isFailoverSyncPending, isFailoverSource: isFailoverSource, isActionsLocked: isActionsLocked, isOnRetiredAlphaGeneration: isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration: isRunningOnUnsupportedGenerationOverride ??
|
|
939
975
|
isRunningOnUnsupportedGenerationFallback }), deleteTarget ? (_jsx(Modal, { open: deleteModalOpen, danger: true, modalHeading: translateCopy('clustermodals:delete.heading', 'Delete cluster'), primaryButtonText: translateCopy('clustermodals:delete.buttons.primary', 'Delete'), secondaryButtonText: translateCopy('clustermodals:delete.buttons.secondary', 'Cancel'), primaryButtonDisabled: deleteBusy || deleteConfirmation.trim() !== 'DELETE', onRequestClose: () => {
|
|
940
976
|
if (deleteBusy)
|
|
941
977
|
return;
|
|
@@ -985,7 +1021,9 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
|
|
|
985
1021
|
params: { orgId, clusterId: tagTarget.clusterId },
|
|
986
1022
|
body: {
|
|
987
1023
|
labels: {
|
|
988
|
-
custom
|
|
1024
|
+
// The backup ID of a migration lives in a custom label.
|
|
1025
|
+
// Send the custom labels again: the PATCH replaces them.
|
|
1026
|
+
custom: customLabelsOf(rawClusters, tagTarget.clusterId),
|
|
989
1027
|
camunda: [selectedTag],
|
|
990
1028
|
},
|
|
991
1029
|
},
|
|
@@ -16,7 +16,9 @@ import { hasAvailableClusterReservation, isDeveloperBlockedFromClusterCreate, us
|
|
|
16
16
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
17
17
|
import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
|
|
18
18
|
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-blocked.js';
|
|
19
|
+
import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
|
|
19
20
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
21
|
+
import { getMigrationInfo, isMigrationPlan, } from '../../utils/migration-workaround.js';
|
|
20
22
|
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
21
23
|
import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
|
|
22
24
|
const DAY = 24 * 60 * 60 * 1000;
|
|
@@ -115,6 +117,17 @@ export const C4DashboardApp = observer((props) => {
|
|
|
115
117
|
const externalUrls = useMemo(() => getC4DashboardUrls({ orgId, overrides: urls }), [orgId, urls]);
|
|
116
118
|
const { fetchClusters, fetchMembers, fetchAudits, fetchClients, fetchClusterCapacity, getClusters, } = data;
|
|
117
119
|
const orgInfo = data.getOrgInfo(orgId);
|
|
120
|
+
// TODO(3844-workaround): The migration state sits in the name prefix, so a
|
|
121
|
+
// cluster in a state shows its name without the prefix.
|
|
122
|
+
const migrationFlagOn = useC4FeatureFlag(SELF_MANAGED_MIGRATION_FLAG);
|
|
123
|
+
const migrationActive = migrationFlagOn &&
|
|
124
|
+
isMigrationPlan(orgInfo?.organizationToSalesPlan?.salesPlan?.salesPlanType);
|
|
125
|
+
const displayClusterName = useCallback((cluster) => migrationActive && typeof cluster.name === 'string'
|
|
126
|
+
? getMigrationInfo({
|
|
127
|
+
name: cluster.name,
|
|
128
|
+
description: cluster.description,
|
|
129
|
+
}).displayName
|
|
130
|
+
: cluster.name, [migrationActive]);
|
|
118
131
|
// Permissions derived from orgInfo. If orgInfo isn't loaded yet, default to
|
|
119
132
|
// not loading privileged data (members/activity). The dashboard should still render.
|
|
120
133
|
const canReadMembers = orgInfo?.permissions?.org?.users?.member?.read;
|
|
@@ -270,7 +283,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
270
283
|
for (const cluster of usageClusters ?? []) {
|
|
271
284
|
const id = getClusterId(cluster);
|
|
272
285
|
if (id && typeof cluster?.name === 'string') {
|
|
273
|
-
clusterNames.set(id, cluster
|
|
286
|
+
clusterNames.set(id, displayClusterName(cluster));
|
|
274
287
|
}
|
|
275
288
|
}
|
|
276
289
|
const { pi, di, latestTaskUsers } = toUsageChartPoints(usagePerDay, clusterNames, orgInfo?.name ?? orgId);
|
|
@@ -285,6 +298,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
285
298
|
: { dataPoints: di },
|
|
286
299
|
};
|
|
287
300
|
}, [
|
|
301
|
+
displayClusterName,
|
|
288
302
|
hostProvidesBilling,
|
|
289
303
|
isLicensingModel2025,
|
|
290
304
|
orgId,
|
|
@@ -347,7 +361,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
347
361
|
}
|
|
348
362
|
return {
|
|
349
363
|
id,
|
|
350
|
-
name: cluster
|
|
364
|
+
name: displayClusterName(cluster),
|
|
351
365
|
status: isClusterReconciliationPaused(cluster)
|
|
352
366
|
? 'maintenance'
|
|
353
367
|
: cluster.status?.ready || 'Unknown',
|
|
@@ -357,7 +371,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
357
371
|
version: cluster.generation?.name || '-',
|
|
358
372
|
};
|
|
359
373
|
})
|
|
360
|
-
.filter((cluster) => Boolean(cluster)), [clusters]);
|
|
374
|
+
.filter((cluster) => Boolean(cluster)), [clusters, displayClusterName]);
|
|
361
375
|
// Check if any cluster has load data
|
|
362
376
|
const clusterLoadAvailable = clusterCapacityMap.size > 0;
|
|
363
377
|
// Get cluster load callback
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
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": "7.
|
|
89
|
-
"@camunda/ccma-shared-types": "12.
|
|
88
|
+
"@camunda/ccma-api": "7.3.0",
|
|
89
|
+
"@camunda/ccma-shared-types": "12.4.0",
|
|
90
90
|
"@pactsafe/pactsafe-react-sdk": "2.15.0",
|
|
91
91
|
"cron-parser": "5.10.2",
|
|
92
92
|
"mobx": "6.16.1",
|