@camunda/ccma-saas-frontend 0.36.3 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import { type JSX } from 'react';
2
2
  import type { C4ClusterDetailsHotBackupsRestoreProps } from './c4-cluster-details-hot-backups-restore.types.js';
3
- export declare const C4ClusterDetailsHotBackupsRestore: ({ open, backup, currentClusterVersion, isSubmitting, onRequestClose, onConfirm, text, }: C4ClusterDetailsHotBackupsRestoreProps) => JSX.Element;
3
+ export declare const C4ClusterDetailsHotBackupsRestore: ({ open, backup, currentClusterVersion, isSubmitting, onRequestClose, onConfirm, versionChoice, versionChoiceLoading, text, }: C4ClusterDetailsHotBackupsRestoreProps) => JSX.Element;
@@ -6,20 +6,30 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  */
7
7
  import { useState } from 'react';
8
8
  import { Checkbox, Modal, Stack } from '../../ui/index.js';
9
+ import { RadioButton, RadioButtonGroup } from '../../ui/families.js';
9
10
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
10
- export const C4ClusterDetailsHotBackupsRestore = ({ open, backup, currentClusterVersion, isSubmitting, onRequestClose, onConfirm, text, }) => {
11
- const isVersionMismatch = backup.version !== currentClusterVersion;
11
+ export const C4ClusterDetailsHotBackupsRestore = ({ open, backup, currentClusterVersion, isSubmitting, onRequestClose, onConfirm, versionChoice, versionChoiceLoading = false, text, }) => {
12
12
  const [acknowledged, setAcknowledged] = useState(false);
13
+ const [chosen, setChosen] = useState();
14
+ const chosenOption = versionChoice?.options.find((option) => option.value === chosen && !option.disabled);
15
+ // With a choice, the warning waits for the choice and compares its version.
16
+ const restoreVersion = versionChoice || versionChoiceLoading
17
+ ? chosenOption?.version
18
+ : backup.version;
19
+ const isVersionMismatch = restoreVersion !== undefined && restoreVersion !== currentClusterVersion;
20
+ // While the versions load, a backup from a window could still need a choice.
21
+ const isChoiceMissing = versionChoiceLoading || (versionChoice !== undefined && !chosenOption);
13
22
  const handleRequestSubmit = () => {
14
- if (isVersionMismatch && !acknowledged) {
23
+ if (isChoiceMissing || (isVersionMismatch && !acknowledged)) {
15
24
  return;
16
25
  }
17
- onConfirm(backup.id);
26
+ onConfirm(backup.id, chosenOption?.value);
18
27
  };
19
28
  const handleRequestClose = () => {
20
29
  if (isSubmitting)
21
30
  return;
22
31
  setAcknowledged(false);
32
+ setChosen(undefined);
23
33
  onRequestClose();
24
34
  };
25
35
  const formatDateTime = (value) => {
@@ -39,7 +49,7 @@ export const C4ClusterDetailsHotBackupsRestore = ({ open, backup, currentCluster
39
49
  hour12: false,
40
50
  });
41
51
  };
42
- return (_jsx(Modal, { id: 'c4-cluster-details-hot-backups-restore', open: open, modalHeading: text.title, primaryButtonText: text.confirmButton, secondaryButtonText: text.cancelButton, primaryButtonDisabled: isSubmitting || (isVersionMismatch && !acknowledged), onRequestSubmit: handleRequestSubmit, onRequestClose: handleRequestClose, size: 'sm', preventCloseOnClickOutside: true,
52
+ return (_jsx(Modal, { id: 'c4-cluster-details-hot-backups-restore', open: open, modalHeading: text.title, primaryButtonText: text.confirmButton, secondaryButtonText: text.cancelButton, primaryButtonDisabled: isSubmitting || isChoiceMissing || (isVersionMismatch && !acknowledged), onRequestSubmit: handleRequestSubmit, onRequestClose: handleRequestClose, size: 'sm', preventCloseOnClickOutside: true,
43
53
  // Restore is irreversible — per project spec, initial keyboard focus
44
54
  // lands on Cancel rather than the destructive primary action.
45
55
  selectorPrimaryFocus: '[data-variant="secondary"]', children: _jsxs(Stack, { gap: 5, children: [_jsxs("dl", { style: {
@@ -48,7 +58,13 @@ export const C4ClusterDetailsHotBackupsRestore = ({ open, backup, currentCluster
48
58
  columnGap: '1rem',
49
59
  rowGap: '0.25rem',
50
60
  margin: 0,
51
- }, children: [_jsx("dt", { children: _jsx("strong", { children: text.backupLabel }) }), _jsx("dd", { style: { margin: 0 }, children: backup.name }), _jsx("dt", { children: _jsx("strong", { children: text.dateLabel }) }), _jsx("dd", { style: { margin: 0 }, children: formatDateTime(backup.completedAt) }), _jsx("dt", { children: _jsx("strong", { children: text.versionLabel }) }), _jsx("dd", { style: { margin: 0 }, children: backup.version })] }), isVersionMismatch ? (_jsxs(_Fragment, { children: [_jsx(C4InlineNotification, { kind: 'warning', lowContrast: true, hideCloseButton: true, title: text.versionMismatchTitle, subtitle: text.versionMismatchBody
61
+ }, children: [_jsx("dt", { children: _jsx("strong", { children: text.backupLabel }) }), _jsx("dd", { style: { margin: 0 }, children: backup.name }), _jsx("dt", { children: _jsx("strong", { children: text.dateLabel }) }), _jsx("dd", { style: { margin: 0 }, children: formatDateTime(backup.completedAt) }), _jsx("dt", { children: _jsx("strong", { children: text.versionLabel }) }), _jsx("dd", { style: { margin: 0 }, children: backup.version })] }), versionChoice && (_jsxs(_Fragment, { children: [_jsx("p", { children: versionChoice.description }), _jsx(RadioButtonGroup, { name: 'c4-cluster-details-hot-backups-restore-version', legendText: versionChoice.legend, valueSelected: chosen ?? '', orientation: 'vertical', onChange: (value) => {
62
+ setChosen(String(value));
63
+ // A new version can give another warning, so ask again.
64
+ setAcknowledged(false);
65
+ }, children: versionChoice.options.map((option) => (_jsx(RadioButton, { id: `c4-cluster-details-hot-backups-restore-version-${option.value}`, value: option.value,
66
+ // The shown version must stay the one that the request uses.
67
+ disabled: option.disabled || isSubmitting, labelText: _jsxs(Stack, { gap: 1, children: [_jsx("span", { children: option.labelText }), _jsx("span", { style: { color: 'var(--neutral-foreground-subtle)' }, children: option.helperText })] }) }, option.value))) })] })), isVersionMismatch ? (_jsxs(_Fragment, { children: [_jsx(C4InlineNotification, { kind: 'warning', lowContrast: true, hideCloseButton: true, title: text.versionMismatchTitle, subtitle: text.versionMismatchBody
52
68
  .replace('{currentVersion}', currentClusterVersion)
53
- .replace('{backupVersion}', backup.version) }), _jsx(Checkbox, { id: 'c4-cluster-details-hot-backups-restore-acknowledge', labelText: text.acknowledgmentLabel, checked: acknowledged, onChange: (_evt, { checked }) => setAcknowledged(checked) })] })) : (_jsx("p", { children: text.description }))] }) }));
69
+ .replace('{backupVersion}', restoreVersion ?? backup.version) }), _jsx(Checkbox, { id: 'c4-cluster-details-hot-backups-restore-acknowledge', labelText: text.acknowledgmentLabel, checked: acknowledged, onChange: (_evt, { checked }) => setAcknowledged(checked) })] })) : (_jsx("p", { children: text.description }))] }) }));
54
70
  };
@@ -1,3 +1,16 @@
1
+ /**
2
+ * twoPhaseUpgradeMockup: a version that a backup from a rollback window can
3
+ * restore on.
4
+ */
5
+ export interface C4ClusterDetailsHotBackupsRestoreVersionOption {
6
+ /** The value that `onConfirm` gets, for example the generation uuid. */
7
+ value: string;
8
+ /** The version after the restore. The version mismatch warning uses it. */
9
+ version: string;
10
+ labelText: string;
11
+ helperText: string;
12
+ disabled: boolean;
13
+ }
1
14
  export interface C4ClusterDetailsHotBackupsRestoreProps {
2
15
  open: boolean;
3
16
  backup: {
@@ -10,7 +23,19 @@ export interface C4ClusterDetailsHotBackupsRestoreProps {
10
23
  /** Disables the primary action and blocks dismissal while a restore request is in flight. */
11
24
  isSubmitting: boolean;
12
25
  onRequestClose: () => void;
13
- onConfirm: (backupId: string) => void;
26
+ /** The second argument is the chosen option, only with `versionChoice`. */
27
+ onConfirm: (backupId: string, version?: string) => void;
28
+ /** The versions are not loaded yet: Restore stays disabled. */
29
+ versionChoiceLoading?: boolean;
30
+ /**
31
+ * twoPhaseUpgradeMockup: the backup can restore on more than one version.
32
+ * The user must choose one. There is no default.
33
+ */
34
+ versionChoice?: {
35
+ legend: string;
36
+ description: string;
37
+ options: C4ClusterDetailsHotBackupsRestoreVersionOption[];
38
+ };
14
39
  text: {
15
40
  title: string;
16
41
  description: string;
@@ -186,7 +186,16 @@
186
186
  "cancelButton": "Cancel",
187
187
  "versionMismatchTitle": "This will change your cluster version",
188
188
  "versionMismatchBody": "Restoring changes your cluster from {currentVersion} to {backupVersion} and permanently overwrites your current data. Cancel to back up first.",
189
- "acknowledgmentLabel": "I understand the version change."
189
+ "acknowledgmentLabel": "I understand the version change.",
190
+ "versionChoice": {
191
+ "versionWithBehavior": "{version} ({behavior} behavior)",
192
+ "legend": "Restore on",
193
+ "description": "This backup was taken after an upgrade that wasn't committed. Both versions restore the same data.",
194
+ "previousHelper": "The version before the upgrade. You can upgrade again later.",
195
+ "backupHelper": "The cluster starts with {behavior} behavior. You can't roll back to {previousBehavior} after the restore.",
196
+ "elasticsearchBlocked": "Not available. This backup has a newer Elasticsearch version than {version}.",
197
+ "generationMissing": "Not available. This version no longer exists."
198
+ }
190
199
  },
191
200
  "infoText0": "For more information, see documentation on <0>backups</0>.",
192
201
  "infoText1": "<0>Learn more about backups</0>",
@@ -49,7 +49,7 @@ export type { C4ClusterDetailsEncryptionProps, ClusterEncryptionData, Encryption
49
49
  export { C4ClusterDetailsHotBackups } from './components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js';
50
50
  export type { BackupItem, BackupScheduleItem, C4ClusterDetailsHotBackupsProps, } from './components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.types.js';
51
51
  export { C4ClusterDetailsHotBackupsRestore } from './components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js';
52
- export type { C4ClusterDetailsHotBackupsRestoreProps } from './components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.types.js';
52
+ export type { C4ClusterDetailsHotBackupsRestoreProps, C4ClusterDetailsHotBackupsRestoreVersionOption, } from './components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.types.js';
53
53
  export { C4ClusterDetailsIpWhitelist } from './components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js';
54
54
  export type { C4ClusterDetailsIpWhitelistProps, IpWhitelistItem, } from './components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.types.js';
55
55
  export { C4ClusterDetailsSecureConnectivity } from './components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
@@ -214,7 +214,7 @@ export { openC4CreateConsoleApiClientModal, setC4CreateConsoleApiClientModalHand
214
214
  export { openC4InviteUserToOrganizationModal, setC4InviteUserToOrganizationModalHandle, } from './modals/c4-invite-user-to-organization-modal-handle.js';
215
215
  export { openC4RenameOrganizationModal, setC4RenameOrganizationModalHandle, } from './modals/c4-rename-organization-modal-handle.js';
216
216
  export type { AccountsPermissions, AddC4ConsoleNotificationOptions, C4BreadcrumbCrumb, C4BreadcrumbDropdownItem, C4ClusterNavAppEntry, C4ClusterNavEntry, C4ConsoleAuthzFeatures, C4ConsoleAuthzState, C4ConsoleDataState, C4ConsoleEventsProviderProps, C4ConsoleNotification, C4ConsoleNotificationAction, C4ConsoleNotificationKind, C4ConsoleNotificationsState, C4ConsoleRuntimeConfig, C4ConsoleVisibilities, C4ResolvedTheme, C4ThemePreference, C4UserNotificationsProviderProps, C4UserNotificationsState, C4UserThemeState, CacheState, CamundaWebApp, ConsoleAuth, ConsoleBackendUrls, ConsoleClickwrapConfig, ConsoleClusterDto, ConsolePermissions, ConsolePublicUrls, ConsoleStage, ConsoleTelemetry, ConsoleUser, ExternalClusterDto, ExternalOrganizationDto, NotificationDto, OrganizationPermissions, OrganizationRole, OrgCache, SseEntity, UpgradableGenerationsDto, UseC4ClusterNavEntriesOptions, UseC4WebappBreadcrumbDataOptions, } from './runtime/index.js';
217
- export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, CONSOLE_CLI_API_FLAG, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, useConsoleCliApi, } from './runtime/index.js';
217
+ export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, CONSOLE_CLI_API_FLAG, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseRestoreMockup, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, useConsoleCliApi, } from './runtime/index.js';
218
218
  export type { MigrationAccess, MigrationAccessStatement, MigrationBackupChoice, MigrationDetectedBackup, MigrationPhase, MigrationReason, MigrationReasonParams, MigrationSourceAccess, MigrationSourceInput, MigrationSourceKind, MigrationSpec, MigrationView, } from './utils/migration-view.js';
219
219
  export type { TranslateFn } from './utils/safe-translate.js';
220
220
  export { ENVIRONMENT_KEY_SUFFIX, safeTranslate, scopedTranslate, } from './utils/safe-translate.js';
package/lib/esm/index.js CHANGED
@@ -123,7 +123,7 @@ export { openC4RenameOrganizationModal, setC4RenameOrganizationModalHandle, } fr
123
123
  // re-listed per module, so the package root and the
124
124
  // `@camunda/ccma-saas-frontend/runtime` subpath expose one identical surface.
125
125
  // Add runtime exports in `src/runtime/index.ts` and mirror them here.
126
- export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, CONSOLE_CLI_API_FLAG, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, useConsoleCliApi, } from './runtime/index.js';
126
+ export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, CONSOLE_CLI_API_FLAG, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseRestoreMockup, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, useConsoleCliApi, } from './runtime/index.js';
127
127
  export { ENVIRONMENT_KEY_SUFFIX, safeTranslate, scopedTranslate, } from './utils/safe-translate.js';
128
128
  export { C4ClusterClientDetailsApp } from './widgets/cluster-client-details/c4-cluster-client-details-app.js';
129
129
  export { C4ClusterDetailsApp } from './widgets/cluster-details/c4-cluster-details-app.js';
@@ -40,5 +40,5 @@ export { useC4UserTheme } from './c4-user-theme.js';
40
40
  export { buildModelerOrgUrl, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, resolveAdminAppName, } from './nav/camunda-apps.js';
41
41
  export type { C4BreadcrumbCrumb, C4BreadcrumbDropdownItem, C4ClusterNavAppEntry, C4ClusterNavEntry, UseC4ClusterNavEntriesOptions, UseC4WebappBreadcrumbDataOptions, } from './nav/use-webapp-nav-data.js';
42
42
  export { useC4ClusterNavEntries, useC4WebappBreadcrumbData, } from './nav/use-webapp-nav-data.js';
43
- export { useC4TwoPhaseUpgradeMockup } from './use-c4-two-phase-upgrade-mockup.js';
43
+ export { useC4TwoPhaseRestoreMockup, useC4TwoPhaseUpgradeMockup, } from './use-c4-two-phase-upgrade-mockup.js';
44
44
  export { CONSOLE_CLI_API_FLAG, useConsoleCliApi } from './use-console-cli-api.js';
@@ -18,5 +18,5 @@ export { C4UserNotificationsProvider, useC4UserNotifications, } from './c4-user-
18
18
  export { useC4UserTheme } from './c4-user-theme.js';
19
19
  export { buildModelerOrgUrl, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, resolveAdminAppName, } from './nav/camunda-apps.js';
20
20
  export { useC4ClusterNavEntries, useC4WebappBreadcrumbData, } from './nav/use-webapp-nav-data.js';
21
- export { useC4TwoPhaseUpgradeMockup } from './use-c4-two-phase-upgrade-mockup.js';
21
+ export { useC4TwoPhaseRestoreMockup, useC4TwoPhaseUpgradeMockup, } from './use-c4-two-phase-upgrade-mockup.js';
22
22
  export { CONSOLE_CLI_API_FLAG, useConsoleCliApi } from './use-console-cli-api.js';
@@ -1,4 +1,4 @@
1
- import { type TwoPhaseUpgradeMode, type TwoPhaseUpgradeStateDto } from '@camunda/ccma-api';
1
+ import { type TwoPhaseUpgradeBackupVersionsDto, type TwoPhaseUpgradeMode, type TwoPhaseUpgradeStateDto } from '@camunda/ccma-api';
2
2
  /**
3
3
  * twoPhaseUpgradeMockup: reads the mock state of the cluster and gives the
4
4
  * commit and mode calls. With `enabled` false it does nothing. Delete this
@@ -21,3 +21,23 @@ export declare function useC4TwoPhaseUpgradeMockup({ enabled, orgId, clusterId,
21
21
  commit: () => Promise<void>;
22
22
  setMode: (mode: TwoPhaseUpgradeMode) => Promise<void>;
23
23
  };
24
+ /**
25
+ * twoPhaseUpgradeMockup: the backups from a rollback window, each with the
26
+ * versions that it can restore on (PDP-3722 decision of Nov 16, 2026). With
27
+ * `enabled` false it does nothing.
28
+ *
29
+ * `refreshKey` changes when the backup list changes, and the hook then reads
30
+ * the versions again. An answer for an older request is dropped. `loaded` is
31
+ * `false` until the answer for the current list is in: the restore must wait
32
+ * for it, because a backup from a window needs a choice.
33
+ */
34
+ export declare function useC4TwoPhaseRestoreMockup({ enabled, orgId, clusterId, refreshKey, }: {
35
+ enabled: boolean;
36
+ orgId: string;
37
+ clusterId: string;
38
+ refreshKey: string;
39
+ }): {
40
+ backupVersions: TwoPhaseUpgradeBackupVersionsDto[];
41
+ loaded: boolean;
42
+ setRestoreChoice: (backupId: string, generationUuid: string) => Promise<void>;
43
+ };
@@ -117,3 +117,68 @@ export function useC4TwoPhaseUpgradeMockup({ enabled, orgId, clusterId, refreshK
117
117
  }, [paramsFor]);
118
118
  return { state, commit, setMode };
119
119
  }
120
+ /**
121
+ * twoPhaseUpgradeMockup: the backups from a rollback window, each with the
122
+ * versions that it can restore on (PDP-3722 decision of Nov 16, 2026). With
123
+ * `enabled` false it does nothing.
124
+ *
125
+ * `refreshKey` changes when the backup list changes, and the hook then reads
126
+ * the versions again. An answer for an older request is dropped. `loaded` is
127
+ * `false` until the answer for the current list is in: the restore must wait
128
+ * for it, because a backup from a window needs a choice.
129
+ */
130
+ export function useC4TwoPhaseRestoreMockup({ enabled, orgId, clusterId, refreshKey, }) {
131
+ const runtime = useC4ConsoleRuntime();
132
+ const [backupVersions, setBackupVersions] = useState([]);
133
+ const [loaded, setLoaded] = useState(false);
134
+ const latest = useRef(0);
135
+ const paramsFor = useCallback(() => orgId
136
+ ? {
137
+ config: toApiConfig(runtime),
138
+ params: { orgId, clusterId },
139
+ }
140
+ : undefined, [runtime, orgId, clusterId]);
141
+ // biome-ignore lint/correctness/useExhaustiveDependencies: refreshKey is the trigger
142
+ useEffect(() => {
143
+ const id = ++latest.current;
144
+ const params = paramsFor();
145
+ setLoaded(false);
146
+ if (!enabled || !params) {
147
+ setBackupVersions([]);
148
+ return;
149
+ }
150
+ void (async () => {
151
+ try {
152
+ const next = await ConsoleTwoPhaseUpgradeMockupService.getBackupVersions(params);
153
+ if (id === latest.current) {
154
+ setBackupVersions(next);
155
+ setLoaded(true);
156
+ }
157
+ }
158
+ catch (error) {
159
+ // No versions: every backup restores as today.
160
+ console.warn('Failed to read the backup versions of the mockup:', error);
161
+ if (id === latest.current) {
162
+ setBackupVersions([]);
163
+ setLoaded(true);
164
+ }
165
+ }
166
+ })();
167
+ }, [enabled, paramsFor, refreshKey]);
168
+ /**
169
+ * The dialog calls this just before the real restore. It throws when the
170
+ * request fails: the user chose a version, and the restore must not use
171
+ * another one.
172
+ */
173
+ const setRestoreChoice = useCallback(async (backupId, generationUuid) => {
174
+ const params = paramsFor();
175
+ if (!params) {
176
+ throw new Error('No organization for the restore choice.');
177
+ }
178
+ await ConsoleTwoPhaseUpgradeMockupService.setRestoreChoice({
179
+ ...params,
180
+ body: { backupId, generationUuid },
181
+ });
182
+ }, [paramsFor]);
183
+ return { backupVersions, loaded, setRestoreChoice };
184
+ }
@@ -7,7 +7,8 @@ import { C4ClusterDetailsHotBackups } from '../../../components/c4-cluster-detai
7
7
  import { C4ClusterDetailsHotBackupsRestore } from '../../../components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js';
8
8
  import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
9
9
  import { useC4ConsoleNotifications } from '../../../runtime/c4-console-notifications-context.js';
10
- import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
10
+ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../../runtime/c4-console-runtime-context.js';
11
+ import { useC4TwoPhaseRestoreMockup } from '../../../runtime/use-c4-two-phase-upgrade-mockup.js';
11
12
  import { useCliPilotApi } from '../../../runtime/use-cli-pilot-api.js';
12
13
  import { useCliResourcesApi } from '../../../runtime/use-cli-resources-api.js';
13
14
  import { Checkbox, Link, Modal, Stack, TextInput } from '../../../ui/index.js';
@@ -304,6 +305,23 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
304
305
  }
305
306
  void reloadHotBackups();
306
307
  }, [isHotBackupEnabled, reloadHotBackups, sseBackupsVersion]);
308
+ // twoPhaseUpgradeMockup: a backup from a rollback window can restore on two
309
+ // versions (PDP-3722 decision of Nov 16, 2026).
310
+ const twoPhaseMockupOn = useC4FeatureFlag('console.twoPhaseUpgradeMockup');
311
+ const twoPhaseRestore = useC4TwoPhaseRestoreMockup({
312
+ enabled: twoPhaseMockupOn && isHotBackupEnabled,
313
+ orgId,
314
+ clusterId,
315
+ refreshKey: `${cluster?.generation?.uuid}|${hotBackups.map((b) => `${b.uuid}:${b.generationUuid ?? ''}`).join(',')}`,
316
+ });
317
+ const withBehavior = (version, behavior) => safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.versionChoice.versionWithBehavior', '{version} ({behavior} behavior)')
318
+ .replace('{version}', version)
319
+ .replace('{behavior}', behavior);
320
+ const backupVersionLabel = (backup) => {
321
+ const versions = twoPhaseRestore.backupVersions.find((candidate) => candidate.backupId === backup.uuid);
322
+ const name = backup.generationName ?? '-';
323
+ return versions ? withBehavior(name, versions.behaviorVersion) : name;
324
+ };
307
325
  const zeebe = cluster?.generation?.versions?.zeebe;
308
326
  const clusterSupportsHotBackups = zeebe
309
327
  ? checkVersion({
@@ -323,7 +341,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
323
341
  completed: toDateOrDash(backup.completed),
324
342
  // Resolved server-side from the backup's `generationUuid` label. Falls
325
343
  // back to '-' for legacy backups that pre-date the label contract.
326
- version: backup.generationName ?? '-',
344
+ version: backupVersionLabel(backup),
327
345
  // Restore is only safe from a terminal-successful backup that carries a
328
346
  // generationUuid label. Without the uuid the backend rejects (legacy
329
347
  // contract); for `In progress` / `Failed` rows the data isn't a valid
@@ -576,15 +594,43 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
576
594
  if (!selectedBackup)
577
595
  return null;
578
596
  const completedAt = toDateOrDash(selectedBackup.completed);
579
- return (_jsx(C4ClusterDetailsHotBackupsRestore, { open: restoreBackupOpen, backup: {
597
+ // twoPhaseUpgradeMockup:
598
+ const selectedVersions = twoPhaseRestore.backupVersions.find((candidate) => candidate.backupId === selectedBackup.uuid);
599
+ const choiceText = (key, fallback) => safeTranslate(t, `clusterdetails:hotbackups.restoreModal.versionChoice.${key}`, fallback);
600
+ const versionChoice = selectedVersions && {
601
+ legend: choiceText('legend', 'Restore on'),
602
+ description: choiceText('description', "This backup was taken after an upgrade that wasn't committed. Both versions restore the same data."),
603
+ options: selectedVersions.options.map((option) => {
604
+ const version = option.generationName || '-';
605
+ const helperText = option.blockedBy === 'elasticsearch'
606
+ ? choiceText('elasticsearchBlocked', 'Not available. This backup has a newer Elasticsearch version than {version}.').replace('{version}', version)
607
+ : option.blockedBy === 'generation-missing'
608
+ ? choiceText('generationMissing', 'Not available. This version no longer exists.')
609
+ : option.behaviorVersion === selectedVersions.behaviorVersion
610
+ ? choiceText('previousHelper', 'The version before the upgrade. You can upgrade again later.')
611
+ : choiceText('backupHelper', "The cluster starts with {behavior} behavior. You can't roll back to {previousBehavior} after the restore.")
612
+ .replace('{behavior}', option.behaviorVersion)
613
+ .replace('{previousBehavior}', selectedVersions.behaviorVersion);
614
+ return {
615
+ value: option.generationUuid,
616
+ version,
617
+ labelText: withBehavior(version, option.behaviorVersion),
618
+ helperText,
619
+ disabled: !option.available,
620
+ };
621
+ }),
622
+ };
623
+ return (_jsx(C4ClusterDetailsHotBackupsRestore
624
+ // A new mount on each open resets the chosen version.
625
+ , { open: restoreBackupOpen, backup: {
580
626
  id: selectedBackup.uuid,
581
627
  name: selectedBackup.name,
582
- version: selectedBackup.generationName ?? '-',
628
+ version: backupVersionLabel(selectedBackup),
583
629
  completedAt: completedAt === '-' ? '' : completedAt,
584
630
  }, currentClusterVersion: cluster?.generation?.name ?? '-', isSubmitting: backupMutationBusy, onRequestClose: () => {
585
631
  trackEvent('listBackups:restore:cancel', 'Close Restore Backup Modal', { backupId: selectedBackupId });
586
632
  setRestoreBackupOpen(false);
587
- }, onConfirm: (backupId) => {
633
+ }, versionChoice: versionChoice, versionChoiceLoading: twoPhaseMockupOn && !twoPhaseRestore.loaded, onConfirm: (backupId, chosenGeneration) => {
588
634
  if (!isHotBackupEnabled)
589
635
  return;
590
636
  // Synchronous guard: `backupMutationBusy` only disables the
@@ -599,6 +645,12 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
599
645
  setBackupMutationBusy(true);
600
646
  setBackupMutationError('');
601
647
  try {
648
+ // twoPhaseUpgradeMockup: the restore reads the choice. Send
649
+ // it also for the generation that took the backup, so that
650
+ // it replaces an older choice that Redis still holds.
651
+ if (chosenGeneration) {
652
+ await twoPhaseRestore.setRestoreChoice(backupId, chosenGeneration);
653
+ }
602
654
  await resourcesApi.backups.restoreHotBackup({
603
655
  config: apiConfig,
604
656
  params: { orgId, clusterId, backupId },
@@ -639,7 +691,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
639
691
  versionMismatchTitle: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.versionMismatchTitle', 'This will change your cluster version'),
640
692
  versionMismatchBody: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.versionMismatchBody', 'Restoring changes your cluster from {currentVersion} to {backupVersion} and permanently overwrites your current data. Cancel to back up first.'),
641
693
  acknowledgmentLabel: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.acknowledgmentLabel', 'I understand the version change.'),
642
- } }));
694
+ } }, `${selectedBackup.uuid}:${restoreBackupOpen}`));
643
695
  })(), _jsx(Modal, { open: editScheduleOpen, modalHeading: scheduleIsCreate
644
696
  ? safeTranslate(t, 'backups:schedule.create.title', 'Create backup schedule')
645
697
  : safeTranslate(t, 'backups:schedule.create.updateTitle', 'Edit backup schedule'), primaryButtonText: scheduleIsCreate
@@ -7,7 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
7
  import { C4GroupsList, C4IdentityContextProvider } from '@camunda/c4-identity';
8
8
  import { useC3Profile } from '@camunda/camunda-composite-components';
9
9
  import { AuditLoggerService, EarlyAccessFeaturesService, HdpService, HttpError, OrganizationMembersService, OrgsService, UsageAlertsService, } from '@camunda/ccma-api';
10
- import { ACTIVITY_RETENTION_CHOICES, ACTIVITY_RETENTION_FLAG, activityRetentionLabel, addMonthsClamped, checkVersion, diffInWholeMonths, getCurrentEnterpriseTerm, getDisplayedSalesPlan, getRevisitedSalesPlanName, IDENTITY_MANAGEMENT_MIN_VERSION, isActivityRetentionMonths, isLimitedActivityRetention, NEW_CLUSTER_ROLES_MIN_VERSION, OrganizationRole, peakWithinTerm, SseEntity, toUtcDayStartMs, USAGE_SALES_PLAN_TYPES, VersionCheckOperator, } from '@camunda/ccma-shared-types';
10
+ import { ACTIVITY_RETENTION_CHOICES, activityRetentionLabel, addMonthsClamped, checkVersion, diffInWholeMonths, getCurrentEnterpriseTerm, getDisplayedSalesPlan, getRevisitedSalesPlanName, IDENTITY_MANAGEMENT_MIN_VERSION, isActivityRetentionMonths, isLimitedActivityRetention, NEW_CLUSTER_ROLES_MIN_VERSION, OrganizationRole, peakWithinTerm, SseEntity, toUtcDayStartMs, USAGE_SALES_PLAN_TYPES, VersionCheckOperator, } from '@camunda/ccma-shared-types';
11
11
  import { observer } from 'mobx-react-lite';
12
12
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
13
13
  import { C4AiUsage } from '../../components/c4-ai-usage/c4-ai-usage.js';
@@ -2074,13 +2074,10 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2074
2074
  ]);
2075
2075
  const canReadActivity = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'activity', 'read']), [org]);
2076
2076
  const clusterDefaultsTabEnabled = useC4FeatureFlag(ORG_CLUSTER_DEFAULTS_FLAG);
2077
- const activityRetentionEnabled = useC4FeatureFlag(ACTIVITY_RETENTION_FLAG);
2078
2077
  const activityRetentionMonths = useMemo(() => {
2079
2078
  const months = org?.['activityRetentionMonths'];
2080
- return activityRetentionEnabled && isActivityRetentionMonths(months)
2081
- ? months
2082
- : undefined;
2083
- }, [activityRetentionEnabled, org]);
2079
+ return isActivityRetentionMonths(months) ? months : undefined;
2080
+ }, [org]);
2084
2081
  // The same permission that the accounts route asks for on the write.
2085
2082
  const canChangeOrgSettings = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'settings', 'update']), [org]);
2086
2083
  const loadAudits = useCallback(async (opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.36.3",
3
+ "version": "0.37.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": "13.2.3",
89
- "@camunda/ccma-shared-types": "18.6.1",
88
+ "@camunda/ccma-api": "13.3.0",
89
+ "@camunda/ccma-shared-types": "18.7.0",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",
92
92
  "mobx": "6.16.1",