@camunda/ccma-saas-frontend 0.5.0 → 0.6.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.
Files changed (43) hide show
  1. package/lib/esm/components/c4-charts-dashboard/elements/bar-chart.js +2 -2
  2. package/lib/esm/components/c4-cluster-client-credentials/c4-cluster-client-credentials.js +1 -1
  3. package/lib/esm/components/c4-cluster-client-credentials-identity/c4-cluster-client-credentials-identity.js +1 -1
  4. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.d.ts +1 -1
  5. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.js +24 -1
  6. package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.types.d.ts +14 -1
  7. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  8. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +24 -9
  9. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +6 -0
  10. package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +2 -0
  11. package/lib/esm/components/c4-cluster-overview/cluster-details.js +10 -1
  12. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +15 -8
  13. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.types.d.ts +1 -0
  14. package/lib/esm/components/c4-structured-list/c4-structured-list.js +15 -1
  15. package/lib/esm/components/shared-charts/ds-line-chart.js +2 -2
  16. package/lib/esm/components/shared-charts/recharts-tokens.d.ts +24 -9
  17. package/lib/esm/components/shared-charts/recharts-tokens.js +40 -13
  18. package/lib/esm/i18n/en/entities/orgroles.json +26 -0
  19. package/lib/esm/i18n/en/modals/backups.json +2 -0
  20. package/lib/esm/i18n/en/pages/clusterdetails.json +1 -0
  21. package/lib/esm/i18n/en/pages/clusters.json +4 -1
  22. package/lib/esm/runtime/nav/use-webapp-nav-data.d.ts +18 -0
  23. package/lib/esm/runtime/nav/use-webapp-nav-data.js +39 -15
  24. package/lib/esm/utils/role-labels.d.ts +25 -7
  25. package/lib/esm/utils/role-labels.js +94 -13
  26. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +11 -2
  27. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.d.ts +2 -0
  28. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +16 -3
  29. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.d.ts +19 -0
  30. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +108 -58
  31. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +3 -0
  32. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +2 -8
  33. package/lib/esm/widgets/clusters/c4-clusters-page.js +18 -1
  34. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +4 -0
  35. package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
  36. package/lib/esm/widgets/management/c4-management-app.js +38 -56
  37. package/lib/esm/widgets/management/c4-management-app.types.d.ts +2 -0
  38. package/lib/esm/widgets/management/tabs/c4-management-users-tab.d.ts +2 -1
  39. package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +46 -17
  40. package/lib/esm/widgets/user-details/c4-user-details-page.d.ts +1 -1
  41. package/lib/esm/widgets/user-details/c4-user-details-page.js +22 -8
  42. package/lib/esm/widgets/user-details/c4-user-details-page.types.d.ts +2 -0
  43. package/package.json +11 -11
@@ -15,6 +15,9 @@ const SWITCHABLE_APPS = [
15
15
  'optimize',
16
16
  'admin',
17
17
  ];
18
+ // Returned when there is nothing to show, so the result is referentially stable
19
+ // while idle or loading regardless of the caller's `options` identity.
20
+ const NO_ENTRIES = [];
18
21
  /**
19
22
  * Headless equivalent of c3's `useClusterSidebarEntries`. Reads the org's
20
23
  * clusters from `useC4ConsoleData` (auto-fetching them on first use) and
@@ -22,23 +25,28 @@ const SWITCHABLE_APPS = [
22
25
  * presentational navigation library maps `app` to its own icon and renders the
23
26
  * rows. Returns `[]` while data is loading or nothing is renderable.
24
27
  *
28
+ * Pass `enabled: false` to keep it idle when mounted above authentication.
29
+ *
25
30
  * Requires `C4ConsoleRuntimeProvider` + `C4ConsoleDataProvider`.
26
31
  */
27
32
  export function useC4ClusterNavEntries(orgId, options = {}) {
28
33
  const data = useC4ConsoleData();
34
+ const { apps = DEFAULT_NAV_APPS, isAppVisible, appTeaserHrefs, appLabels, enabled = true, } = options;
29
35
  useEffect(() => {
30
- if (orgId) {
36
+ if (enabled && orgId) {
31
37
  void data.fetchWebappClusters(orgId);
32
38
  }
33
- }, [data, orgId]);
39
+ }, [data, orgId, enabled]);
34
40
  // Read through useObserver so this hook re-renders its caller when the
35
41
  // webapp-cluster data changes, even when that caller is not itself an
36
42
  // observer (the data context value is stable and no longer bumps globally).
37
- const clusters = useObserver(() => data.getWebappClusters(orgId));
38
- const { apps = DEFAULT_NAV_APPS, isAppVisible, appTeaserHrefs, appLabels, } = options;
43
+ // While disabled the read is skipped entirely: touching the store here would
44
+ // subscribe to that observable and keep re-rendering the caller on unrelated
45
+ // store changes, so a disabled hook would not really be idle.
46
+ const clusters = useObserver(() => enabled ? data.getWebappClusters(orgId) : undefined);
39
47
  return useMemo(() => {
40
48
  if (!clusters) {
41
- return [];
49
+ return NO_ENTRIES;
42
50
  }
43
51
  return clusters.flatMap((cluster) => {
44
52
  const appEntries = apps.flatMap((app) => {
@@ -82,6 +90,11 @@ export function useC4ClusterNavEntries(orgId, options = {}) {
82
90
  });
83
91
  }, [clusters, apps, isAppVisible, appTeaserHrefs, appLabels]);
84
92
  }
93
+ // ── Webapp breadcrumbs ──────────────────────────────────────────────────────
94
+ // Returned by the disabled hook, so the result is referentially stable while
95
+ // idle even when the caller passes an inline `webappLinks` object (which would
96
+ // otherwise invalidate the memo on every render).
97
+ const NO_CRUMBS = [];
85
98
  /**
86
99
  * Headless equivalent of c3's `useClusterWebappBreadcrumbs`. Builds the
87
100
  * `[Org] > [Cluster] > [App]` chain as plain data (labels, hrefs, dropdown
@@ -92,24 +105,34 @@ export function useC4ClusterNavEntries(orgId, options = {}) {
92
105
  * Requires `C4ConsoleRuntimeProvider` + `C4ConsoleDataProvider`.
93
106
  */
94
107
  export function useC4WebappBreadcrumbData(options) {
95
- const { orgId, currentApp, currentClusterUuid, webappLinks } = options;
108
+ const { orgId, currentApp, currentClusterUuid, webappLinks, enabled = true, } = options;
96
109
  const runtime = useC4ConsoleRuntime();
97
110
  const data = useC4ConsoleData();
98
111
  useEffect(() => {
99
- void data.fetchMyOrgs();
100
- }, [data]);
112
+ if (enabled) {
113
+ void data.fetchMyOrgs();
114
+ }
115
+ }, [data, enabled]);
101
116
  useEffect(() => {
102
- if (orgId) {
117
+ if (enabled && orgId) {
103
118
  void data.fetchWebappClusters(orgId);
104
119
  }
105
- }, [data, orgId]);
120
+ }, [data, orgId, enabled]);
106
121
  // Read through useObserver so this hook re-renders its caller when the orgs
107
- // or webapp-cluster data changes, even for non-observer callers.
108
- const { orgs, clusters } = useObserver(() => ({
109
- orgs: data.getMyOrgs(),
110
- clusters: data.getWebappClusters(orgId),
111
- }));
122
+ // or webapp-cluster data changes, even for non-observer callers. While
123
+ // disabled the reads are skipped entirely: touching the store here would
124
+ // subscribe to those observables and keep re-rendering the caller on
125
+ // unrelated store changes, so a disabled hook would not really be idle.
126
+ const { orgs, clusters } = useObserver(() => enabled
127
+ ? {
128
+ orgs: data.getMyOrgs(),
129
+ clusters: data.getWebappClusters(orgId),
130
+ }
131
+ : { orgs: undefined, clusters: undefined });
112
132
  return useMemo(() => {
133
+ if (!enabled) {
134
+ return NO_CRUMBS;
135
+ }
113
136
  const crumbs = [];
114
137
  const modelerUrl = webappLinks?.modeler ?? runtime.publicUrls?.modelerBaseUrl;
115
138
  const allOrgs = orgs ?? [];
@@ -208,6 +231,7 @@ export function useC4WebappBreadcrumbData(options) {
208
231
  });
209
232
  return crumbs;
210
233
  }, [
234
+ enabled,
211
235
  orgs,
212
236
  clusters,
213
237
  orgId,
@@ -1,18 +1,36 @@
1
1
  import { type AssignableOrganizationRoleType } from '@camunda/ccma-shared-types';
2
2
  type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
3
- export declare const LEGACY_SECTION_ROLES: AssignableOrganizationRoleType[];
3
+ /** The 8.7-cluster legacy section, minus anything the aligned model promotes. */
4
+ export declare function legacySectionRoles(permissionsReworkEnabled: boolean): AssignableOrganizationRoleType[];
4
5
  /**
5
- * Whether a role from the legacy section may be offered: freely while the org
6
- * has an 8.7-or-older cluster; Developer/Visitor/Task user additionally stay
7
- * offered to a holder so they can be removed.
6
+ * Order a primary-role list for display. A no-op when the aligned model is off;
7
+ * unranked roles keep their relative position after the ranked ones.
8
8
  */
9
- export declare function isRoleAssignable(role: string, showLegacyClusterRoles: boolean, heldRoles: ReadonlySet<string>): boolean;
10
- export declare function isLegacyLabeledRole(role: string, showLegacyClusterRoles: boolean): boolean;
9
+ export declare function orderPrimaryRoles<T extends string>(roles: readonly T[], permissionsReworkEnabled: boolean): T[];
10
+ /**
11
+ * Whether a role may be offered for new assignment. MEMBER predates the cluster
12
+ * roles and is never newly assignable, only removable from a holder. A legacy
13
+ * role is offered freely while the org has an 8.7-or-older cluster, and stays
14
+ * offered to a holder either way so it can be removed. Every other role (the
15
+ * primary/ladder roles, and DevOps once promoted out of the legacy set) is
16
+ * freely assignable regardless of cluster version.
17
+ */
18
+ export declare function isRoleAssignable(role: string, showLegacyClusterRoles: boolean, heldRoles: ReadonlySet<string>, permissionsReworkEnabled?: boolean): boolean;
19
+ export declare function isLegacyLabeledRole(role: string, showLegacyClusterRoles: boolean, permissionsReworkEnabled?: boolean): boolean;
11
20
  /** Section heading: verbose 8.7 copy while such a cluster exists, else the unassign-only copy. */
12
21
  export declare function moreRolesHeadingText(t: TranslateFn | undefined, showLegacyClusterRoles: boolean): string;
13
- /** Resolve a role's label and description from the `orgroles` i18n namespace. */
22
+ /**
23
+ * Resolve a role's label and description from the `orgroles` i18n namespace.
24
+ *
25
+ * When `permissionsReworkEnabled` is set (supplied by the host app, gated
26
+ * behind its feature flag), roles with an aligned label read from the
27
+ * `orgroles:aligned.*` keys instead; those descriptions carry a "Formerly the
28
+ * X role." transition note. Roles without an aligned label fall through to the
29
+ * pre-alignment keys so the flag only moves what the aligned model renames.
30
+ */
14
31
  export declare function roleLabelDescription(t: TranslateFn | undefined, role: string, options?: {
15
32
  legacy?: boolean;
33
+ permissionsReworkEnabled?: boolean;
16
34
  }): {
17
35
  label: string;
18
36
  description: string;
@@ -18,7 +18,7 @@ function safeTranslate(t, key, defaultValue) {
18
18
  }
19
19
  }
20
20
  // Historical UI order of the 8.7-cluster roles section.
21
- export const LEGACY_SECTION_ROLES = [
21
+ const LEGACY_SECTION_ROLES = [
22
22
  OrganizationRole.VISITOR,
23
23
  OrganizationRole.OPERATIONS_ENGINEER,
24
24
  OrganizationRole.TASK_USER,
@@ -26,25 +26,68 @@ export const LEGACY_SECTION_ROLES = [
26
26
  ];
27
27
  const LEGACY_HELD_ROLES = new Set(LegacyHeldOrganizationRole);
28
28
  /**
29
- * Whether a role from the legacy section may be offered: freely while the org
30
- * has an 8.7-or-older cluster; Developer/Visitor/Task user additionally stay
31
- * offered to a holder so they can be removed.
29
+ * Under the aligned model Operations engineer becomes the go-forward DevOps role
30
+ * (camunda-hub#25467), so it stops being a legacy role: callers list it among the
31
+ * primary roles instead, and the legacy rules below no longer match it. Single
32
+ * source of truth, so there is no per-rule exception for it.
32
33
  */
33
- export function isRoleAssignable(role, showLegacyClusterRoles, heldRoles) {
34
- // MEMBER predates the cluster roles and is never newly assignable.
34
+ function isLegacyRole(role, permissionsReworkEnabled) {
35
+ if (permissionsReworkEnabled &&
36
+ role === OrganizationRole.OPERATIONS_ENGINEER) {
37
+ return false;
38
+ }
39
+ return LEGACY_HELD_ROLES.has(role);
40
+ }
41
+ /** The 8.7-cluster legacy section, minus anything the aligned model promotes. */
42
+ export function legacySectionRoles(permissionsReworkEnabled) {
43
+ return LEGACY_SECTION_ROLES.filter((role) => isLegacyRole(role, permissionsReworkEnabled));
44
+ }
45
+ const ALIGNED_PRIMARY_ORDER = [
46
+ OrganizationRole.MODELER,
47
+ OrganizationRole.ANALYST,
48
+ OrganizationRole.OPERATIONS_ENGINEER,
49
+ OrganizationRole.ADMIN,
50
+ OrganizationRole.OWNER,
51
+ ];
52
+ /**
53
+ * Order a primary-role list for display. A no-op when the aligned model is off;
54
+ * unranked roles keep their relative position after the ranked ones.
55
+ */
56
+ export function orderPrimaryRoles(roles, permissionsReworkEnabled) {
57
+ if (!permissionsReworkEnabled) {
58
+ return [...roles];
59
+ }
60
+ const rank = (role) => {
61
+ const index = ALIGNED_PRIMARY_ORDER.indexOf(role);
62
+ return index === -1 ? ALIGNED_PRIMARY_ORDER.length : index;
63
+ };
64
+ return [...roles]
65
+ .map((role, index) => ({ role, index }))
66
+ .sort((a, b) => rank(a.role) - rank(b.role) || a.index - b.index)
67
+ .map(({ role }) => role);
68
+ }
69
+ /**
70
+ * Whether a role may be offered for new assignment. MEMBER predates the cluster
71
+ * roles and is never newly assignable, only removable from a holder. A legacy
72
+ * role is offered freely while the org has an 8.7-or-older cluster, and stays
73
+ * offered to a holder either way so it can be removed. Every other role (the
74
+ * primary/ladder roles, and DevOps once promoted out of the legacy set) is
75
+ * freely assignable regardless of cluster version.
76
+ */
77
+ export function isRoleAssignable(role, showLegacyClusterRoles, heldRoles, permissionsReworkEnabled = false) {
35
78
  if (role === OrganizationRole.MEMBER) {
36
79
  return heldRoles.has(role);
37
80
  }
38
- if (LEGACY_HELD_ROLES.has(role)) {
81
+ if (isLegacyRole(role, permissionsReworkEnabled)) {
39
82
  return showLegacyClusterRoles || heldRoles.has(role);
40
83
  }
41
- return showLegacyClusterRoles;
84
+ return true;
42
85
  }
43
- export function isLegacyLabeledRole(role, showLegacyClusterRoles) {
86
+ export function isLegacyLabeledRole(role, showLegacyClusterRoles, permissionsReworkEnabled = false) {
44
87
  if (role === OrganizationRole.MEMBER) {
45
88
  return true;
46
89
  }
47
- return !showLegacyClusterRoles && LEGACY_HELD_ROLES.has(role);
90
+ return !showLegacyClusterRoles && isLegacyRole(role, permissionsReworkEnabled);
48
91
  }
49
92
  /** Section heading: verbose 8.7 copy while such a cluster exists, else the unassign-only copy. */
50
93
  export function moreRolesHeadingText(t, showLegacyClusterRoles) {
@@ -64,13 +107,51 @@ const ROLE_LABEL_DEFAULTS = {
64
107
  [OrganizationRole.VISITOR]: 'Visitor',
65
108
  [OrganizationRole.MODELER]: 'Modeler',
66
109
  };
67
- /** Resolve a role's label and description from the `orgroles` i18n namespace. */
110
+ /**
111
+ * Aligned org-role labels (camunda-hub#25467). A role appears here when the
112
+ * aligned model gives it new copy; anything absent keeps its pre-alignment label
113
+ * and description. Display projection only; raw role ids are unchanged.
114
+ *
115
+ * Org Owner / Org Admin use the short form so the familiar terms survive while
116
+ * naming the org level, now that Workspace Admin exists. `member` is renamed
117
+ * because `modeler` takes over the "Member" name; it is a rename, not a
118
+ * promotion, so it stays legacy-marked. `analyst` is here only for its
119
+ * description, which now refers to Member rather than Modeler.
120
+ */
121
+ const ALIGNED_ROLE_LABEL_DEFAULTS = {
122
+ [OrganizationRole.OWNER]: 'Org Owner',
123
+ [OrganizationRole.ADMIN]: 'Org Admin',
124
+ [OrganizationRole.MODELER]: 'Member',
125
+ [OrganizationRole.OPERATIONS_ENGINEER]: 'DevOps',
126
+ [OrganizationRole.MEMBER]: 'Console Member',
127
+ [OrganizationRole.ANALYST]: 'Analyst',
128
+ };
129
+ /**
130
+ * Resolve a role's label and description from the `orgroles` i18n namespace.
131
+ *
132
+ * When `permissionsReworkEnabled` is set (supplied by the host app, gated
133
+ * behind its feature flag), roles with an aligned label read from the
134
+ * `orgroles:aligned.*` keys instead; those descriptions carry a "Formerly the
135
+ * X role." transition note. Roles without an aligned label fall through to the
136
+ * pre-alignment keys so the flag only moves what the aligned model renames.
137
+ */
68
138
  export function roleLabelDescription(t, role, options) {
69
139
  const normalized = role.toLowerCase().replace(/[^a-z]/g, '');
140
+ const alignedLabel = options?.permissionsReworkEnabled
141
+ ? ALIGNED_ROLE_LABEL_DEFAULTS[role]
142
+ : undefined;
70
143
  const fallback = ROLE_LABEL_DEFAULTS[role] ??
71
144
  (role ? role.charAt(0).toUpperCase() + role.slice(1) : role);
72
- const label = safeTranslate(t, `orgroles:${normalized}.label`, fallback);
73
- const description = safeTranslate(t, `orgroles:${normalized}.description`, '');
145
+ const { label, description } = alignedLabel
146
+ ? {
147
+ label: safeTranslate(t, `orgroles:aligned.${normalized}.label`, alignedLabel),
148
+ description: safeTranslate(t, `orgroles:aligned.${normalized}.description`, ''),
149
+ }
150
+ : {
151
+ label: safeTranslate(t, `orgroles:${normalized}.label`, fallback),
152
+ description: safeTranslate(t, `orgroles:${normalized}.description`, ''),
153
+ };
154
+ // A renamed role can still be legacy: Console Member keeps the suffix.
74
155
  if (options?.legacy) {
75
156
  const suffix = safeTranslate(t, 'orgroles:legacySuffix', 'Legacy');
76
157
  return { label: `${label} (${suffix})`, description };
@@ -1152,7 +1152,8 @@ export const C4ClusterDetailsApp = observer((props) => {
1152
1152
  canUpdate: Boolean(orgPermissions?.cluster.connectorSecrets.update),
1153
1153
  canDelete: Boolean(orgPermissions?.cluster.connectorSecrets.delete),
1154
1154
  }, docsUrl: urls.docs.connectorSecrets, t: t, onNavigate: props.onNavigate }));
1155
- const hotBackupsComponent = (_jsx(C4ClusterDetailsHotBackupsTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, canMutateCluster: canMutateCluster, isHotBackupEnabled: Boolean(orgInfo?.organizationToSalesPlan?.limits?.hotBackup), docsUrls: {
1155
+ const hotBackupsComponent = (_jsx(C4ClusterDetailsHotBackupsTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, canMutateCluster: canMutateCluster, isHotBackupEnabled: Boolean(orgInfo?.organizationToSalesPlan?.limits?.hotBackup), manualBackupRetainedCount: orgInfo?.organizationToSalesPlan?.limits?.hotBackupManualRetainedCount, scheduledBackupRetainedCount: orgInfo?.organizationToSalesPlan?.limits
1156
+ ?.hotBackupScheduledRetainedCount, docsUrls: {
1156
1157
  hotBackups: urls.docs.hotBackups,
1157
1158
  support: urls.docs.support,
1158
1159
  contact: urls.docs.contact,
@@ -1206,7 +1207,15 @@ export const C4ClusterDetailsApp = observer((props) => {
1206
1207
  reloadCluster,
1207
1208
  urls.docs.auditlogs,
1208
1209
  ]);
1209
- const encryptionComponent = (_jsx(C4ClusterDetailsEncryptionTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, translate: t ?? ((key) => key), activeTabId: activeTabId, onReloadCluster: reloadCluster, restoreInProgress: cluster?.restoreInProgress, docsUrls: {
1210
+ // Both halves of a failover pair share a stableId, and the source is
1211
+ // flagged isFailoverSource — so the pair can be matched from the org's
1212
+ // cluster list without a dedicated backend field.
1213
+ const isFailoverTarget = Boolean(cluster?.stableId &&
1214
+ !cluster.isFailoverSource &&
1215
+ clustersOfOrg?.some((sibling) => sibling.uuid !== cluster.uuid &&
1216
+ sibling.stableId === cluster.stableId &&
1217
+ sibling.isFailoverSource === true));
1218
+ const encryptionComponent = (_jsx(C4ClusterDetailsEncryptionTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, translate: t ?? ((key) => key), activeTabId: activeTabId, onReloadCluster: reloadCluster, restoreInProgress: cluster?.restoreInProgress, isFailoverTarget: isFailoverTarget, docsUrls: {
1210
1219
  encryption: urls.docs.encryption,
1211
1220
  encryptionCli: urls.docs.encryptionCli,
1212
1221
  encryptionManual: urls.docs.encryptionManual,
@@ -11,6 +11,8 @@ interface C4ClusterDetailsEncryptionTabProps {
11
11
  activeTabId: string;
12
12
  onReloadCluster: () => void;
13
13
  restoreInProgress?: boolean;
14
+ /** True when this cluster was created by failing over from a sibling. */
15
+ isFailoverTarget?: boolean;
14
16
  docsUrls: {
15
17
  encryption: string;
16
18
  encryptionCli: string;
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ConsoleByokScriptsService, ConsoleClusterService, } from '@camunda/ccma-api';
3
- import { deriveEncryptionStatus, } from '@camunda/ccma-shared-types';
3
+ import { deriveEncryptionStatus, deriveFailoverKeyPolicyPrincipals, } from '@camunda/ccma-shared-types';
4
4
  import { useCallback, useEffect, useState } from 'react';
5
5
  import { C4ClusterDetailsEncryption } from '../../../components/c4-cluster-details-encryption/c4-cluster-details-encryption.js';
6
6
  // ARN validation patterns
@@ -24,7 +24,7 @@ function toIsoString(value) {
24
24
  return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
25
25
  }
26
26
  export const C4ClusterDetailsEncryptionTab = (props) => {
27
- const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, docsUrls, } = props;
27
+ const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, isFailoverTarget, docsUrls, } = props;
28
28
  // BYOK script content
29
29
  const [byokCliSingle, setByokCliSingle] = useState('');
30
30
  const [byokCliDual, setByokCliDual] = useState('');
@@ -127,6 +127,13 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
127
127
  };
128
128
  // Render templates with cluster-specific values
129
129
  const tenantRoleArn = cluster?.status?.accountId ?? '';
130
+ // For a failed-over cluster, the three principals in the failover region
131
+ // that need access to the (already configured) keys. All are derived from
132
+ // the cluster's own role ARN plus the stableId carried over from its
133
+ // source, so nothing has to be persisted or fetched separately.
134
+ const failoverKeyPolicy = isFailoverTarget && encryptionStatus === 'ExternalEncryptionKeyNotReady'
135
+ ? deriveFailoverKeyPolicyPrincipals(tenantRoleArn, cluster?.stableId)
136
+ : undefined;
130
137
  const renderedPolicy = byokKeyPolicy.replaceAll('<TENANT-ROLE-ARN>', tenantRoleArn);
131
138
  const cliTemplate = isDualRegion ? byokCliDual : byokCliSingle;
132
139
  const renderedCli = cliTemplate
@@ -190,7 +197,7 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
190
197
  isDualRegion,
191
198
  status: encryptionStatus,
192
199
  accountId: tenantRoleArn,
193
- }, encryption: encryption, scripts: {
200
+ }, encryption: encryption, failoverKeyPolicy: failoverKeyPolicy, scripts: {
194
201
  cliScript: renderedCli,
195
202
  keyPolicy: renderedPolicy,
196
203
  }, text: {
@@ -227,6 +234,12 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
227
234
  confirmEncryptionBothRegions: 'Confirm Encryption for both regions',
228
235
  downloadCliScript: 'Download CLI script',
229
236
  downloadKeyPolicy: 'Download key policy',
237
+ failoverKeyPolicyTitle: 'Action required',
238
+ failoverKeyPolicyText: 'Update your encryption key policy so this cluster can read its restored data.',
239
+ failoverKeyPolicyInstruction: 'This cluster uses the encryption keys from the cluster it was failed over from, so no new key is needed. Grant the three roles below the same key permissions as your original cluster, on both the primary and secondary key. Until then, the restore cannot decrypt your backup data.',
240
+ failoverKeyPolicyCloneRole: 'Clone role — copies backup data into this cluster',
241
+ failoverKeyPolicyClusterRole: "This cluster's role",
242
+ failoverKeyPolicyReplicationRole: 'Replication role — replicates to the secondary region',
230
243
  }, urls: {
231
244
  byokMain: docsUrls.encryption,
232
245
  cliScriptLearnMore: docsUrls.encryptionCli,
@@ -3,6 +3,17 @@ import type { ConsoleClusterDto } from '@camunda/ccma-shared-types';
3
3
  import type { JSX } from 'react';
4
4
  import type { C4ClusterDetailsNavigateEvent } from '../c4-cluster-details-app.types.js';
5
5
  type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
6
+ export declare function parseCronSchedule(schedule: string): {
7
+ frequency: string;
8
+ startTime?: string;
9
+ };
10
+ export type ScheduleFrequency = '15min' | '30min' | 'hourly' | 'daily' | 'weekly';
11
+ export declare function buildScheduleCronOverrides(frequency: ScheduleFrequency, startingHour: number, startingMinute: number, weekdays: string[]): Record<string, unknown>;
12
+ export declare function deriveScheduleFormState(schedule: string): {
13
+ frequency: ScheduleFrequency;
14
+ startingTime: string;
15
+ weekdays: string[];
16
+ } | undefined;
6
17
  interface C4ClusterDetailsHotBackupsTabProps {
7
18
  cluster: ConsoleClusterDto | undefined;
8
19
  orgId: string;
@@ -10,6 +21,14 @@ interface C4ClusterDetailsHotBackupsTabProps {
10
21
  apiConfig: RequestBaseParamsConfig;
11
22
  canMutateCluster: boolean;
12
23
  isHotBackupEnabled: boolean;
24
+ /**
25
+ * Org-limit overrides for how many backups the operator retains before
26
+ * deleting the oldest (`hotBackupManualRetainedCount` /
27
+ * `hotBackupScheduledRetainedCount`). Defaults to 3 — the operator's own
28
+ * default — when unset.
29
+ */
30
+ manualBackupRetainedCount?: number;
31
+ scheduledBackupRetainedCount?: number;
13
32
  docsUrls: {
14
33
  hotBackups: string;
15
34
  support: string;