@camunda/ccma-saas-frontend 0.28.9 → 0.29.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 { C4ClusterDetailsEncryptionProps } from './c4-cluster-details-encryption.types.js';
3
- export declare const C4ClusterDetailsEncryption: ({ cluster, encryption, failoverKeyPolicy, failoverCloneRolePolicyStatement, secondaryReplicationNotReady, scripts, text, urls, onSetARN, onUpdatePrimaryARN, onUpdateSecondaryARN, onDownloadScript, onDownloadKeyPolicy, disabled, }: C4ClusterDetailsEncryptionProps) => JSX.Element;
3
+ export declare const C4ClusterDetailsEncryption: ({ cluster, encryption, failoverKeyPolicy, failoverCloneRolePolicyStatement, secondaryReplicationNotReady, keyStatuses, scripts, text, urls, onSetARN, onUpdatePrimaryARN, onUpdateSecondaryARN, onDownloadScript, onDownloadKeyPolicy, disabled, }: C4ClusterDetailsEncryptionProps) => JSX.Element;
@@ -10,9 +10,10 @@ import { Button, CodeSnippet, Link, Stack, TextInput, Tile } from '../../ui/inde
10
10
  import { Tab, TabList, TabPanel, TabPanels, Tabs } from '../../ui/tabs.js';
11
11
  import { SECTION_HEADING_STYLE } from '../../utils/section-heading-style.js';
12
12
  import { DS_STATUS_ICON_COLORS, SpinningLoader, } from '../c4-cluster-overview/ds-status-icon-text.js';
13
+ import { C4EncryptionKeyStatus, C4EncryptionKeysSummary, } from '../c4-encryption-key-status/c4-encryption-key-status.js';
13
14
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
14
15
  import { C4StructuredListBody, C4StructuredListCell, C4StructuredListRow, C4StructuredListWrapper, } from '../c4-structured-list/c4-structured-list.js';
15
- export const C4ClusterDetailsEncryption = ({ cluster, encryption, failoverKeyPolicy, failoverCloneRolePolicyStatement, secondaryReplicationNotReady, scripts, text, urls, onSetARN, onUpdatePrimaryARN, onUpdateSecondaryARN, onDownloadScript, onDownloadKeyPolicy, disabled = false, }) => {
16
+ export const C4ClusterDetailsEncryption = ({ cluster, encryption, failoverKeyPolicy, failoverCloneRolePolicyStatement, secondaryReplicationNotReady, keyStatuses, scripts, text, urls, onSetARN, onUpdatePrimaryARN, onUpdateSecondaryARN, onDownloadScript, onDownloadKeyPolicy, disabled = false, }) => {
16
17
  const [selectedIndex, setSelectedIndex] = useState(0);
17
18
  const handleTabChange = (evt) => {
18
19
  setSelectedIndex(evt.selectedIndex);
@@ -24,6 +25,7 @@ export const C4ClusterDetailsEncryption = ({ cluster, encryption, failoverKeyPol
24
25
  CreationError: statusLine(CircleX, DS_STATUS_ICON_COLORS.danger, 'An error occurred while setting up encryption'),
25
26
  EncryptedStorageNotReady: statusLine(TriangleAlert, DS_STATUS_ICON_COLORS.warning, 'Encrypted Storage is not ready'),
26
27
  ExternalEncryptionKeyNotReady: statusLine(TriangleAlert, DS_STATUS_ICON_COLORS.warning, 'External encryption key is not ready'),
28
+ ExternalEncryptionKeyGrantNotReady: statusLine(TriangleAlert, DS_STATUS_ICON_COLORS.warning, 'External encryption key is not ready'),
27
29
  ExternalEncryptionKeyNotSupplied: statusLine(TriangleAlert, DS_STATUS_ICON_COLORS.warning, 'Unconfigured'),
28
30
  };
29
31
  // Replication to the secondary region can fail silently, so this warning
@@ -88,6 +90,20 @@ export const C4ClusterDetailsEncryption = ({ cluster, encryption, failoverKeyPol
88
90
  }
89
91
  })()] }));
90
92
  }
93
+ // With a status for each key, the key cards replace the ARN rows, so the
94
+ // customer sees which key fails and why. Without one (an operator before
95
+ // camunda/camunda-operator#6165, or the flag off) the views below stay as
96
+ // they were. The failover guidance stays first, because it says which
97
+ // principals to add. A secondary key card replaces the replication
98
+ // warning, because the card shows the same secondary key problem.
99
+ const hasSecondaryCard = keyStatuses?.keys.some((key) => key.key === 'secondary') ?? false;
100
+ if (keyStatuses &&
101
+ keyStatuses.keys.length > 0 &&
102
+ cluster.primaryEncryptionKeyId !== null &&
103
+ !encryption.actionRequired &&
104
+ !failoverKeyPolicy) {
105
+ return (_jsxs(_Fragment, { children: [!hasSecondaryCard && secondaryReplicationWarning, _jsxs(Stack, { gap: 6, children: [_jsx("h3", { style: SECTION_HEADING_STYLE, children: text.title }), _jsx("p", { children: text.infoText }), _jsx(Link, { target: '_blank', href: urls.byokMain, children: text.dokuLink }), _jsx(Tile, { children: _jsx(C4StructuredListWrapper, { children: _jsxs(C4StructuredListBody, { children: [_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '13.5rem' }, children: text.dataTileEncryptionType }), _jsx(C4StructuredListCell, { children: "External / AWS" })] }), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '13.5rem' }, children: text.dataTileStatus }), _jsx(C4StructuredListCell, { children: _jsx(C4EncryptionKeysSummary, { keys: keyStatuses.keys, tenantRoleArn: cluster.accountId ?? '' }) })] }), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '13.5rem' }, children: text.dataTileCreated }), _jsx(C4StructuredListCell, { children: cluster.created ? formatDate(cluster.created) : '' })] }), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '13.5rem' }, children: "Key policy" }), _jsx(C4StructuredListCell, { children: _jsx(CodeSnippet, { type: 'multi', wrapText: true, maxCollapsedNumberOfRows: 20, children: scripts.keyPolicy }) })] })] }) }) }), _jsx(C4EncryptionKeyStatus, { keys: keyStatuses.keys, tenantRoleArn: cluster.accountId ?? '', docsUrl: keyStatuses.docsUrl })] })] }));
106
+ }
91
107
  if (cluster.status === 'Ready') {
92
108
  return (_jsxs(_Fragment, { children: [secondaryReplicationWarning, _jsxs(Stack, { gap: 6, children: [_jsx("h3", { style: SECTION_HEADING_STYLE, children: text.title }), _jsx("p", { children: text.infoText }), _jsx(Link, { target: '_blank', href: urls.byokMain, children: text.dokuLink }), _jsx(Tile, { children: _jsx(C4StructuredListWrapper, { children: _jsxs(C4StructuredListBody, { children: [_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: text.dataTileEncryptionType }), _jsx(C4StructuredListCell, { children: "External / AWS" })] }), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: text.dataTileStatus }), _jsx(C4StructuredListCell, { children: status[cluster.status] })] }), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: text.dataTileCreated }), _jsx(C4StructuredListCell, { children: cluster.created ? formatDate(cluster.created) : '' })] }), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: text.dataTileRegion }), _jsx(C4StructuredListCell, { children: cluster.region })] }), cluster.isDualRegion && cluster.backupRegion && (_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: text.dataTileSecondaryRegion }), _jsx(C4StructuredListCell, { children: cluster.backupRegion })] })), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: "ARN" }), _jsx(C4StructuredListCell, { children: _jsx(CodeSnippet, { type: 'single', children: cluster.primaryEncryptionKeyId }) })] }), cluster.isDualRegion && cluster.secondaryEncryptionKeyId && (_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: "ARN" }), _jsx(C4StructuredListCell, { children: _jsx(CodeSnippet, { type: 'single', children: cluster.secondaryEncryptionKeyId }) })] })), _jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '216px' }, children: "Key Policy" }), _jsx(C4StructuredListCell, { children: _jsx(CodeSnippet, { type: 'multi', wrapText: true, maxCollapsedNumberOfRows: 20, children: scripts.keyPolicy }) })] })] }) }) })] })] }));
93
109
  }
@@ -98,9 +114,10 @@ export const C4ClusterDetailsEncryption = ({ cluster, encryption, failoverKeyPol
98
114
  // operator reports the key as usable the `Ready` branch above wins, so this
99
115
  // is reached only while the key policy is still missing the new principals.
100
116
  if (failoverKeyPolicy) {
101
- return (_jsxs(_Fragment, { children: [secondaryReplicationWarning, _jsx(C4InlineNotification, { style: { maxWidth: '100%', width: '100%', marginBottom: '24px' }, lowContrast: true, kind: 'warning', title: text.failoverKeyPolicyTitle, subtitle: text.failoverKeyPolicyText, hideCloseButton: true }), _jsxs(Stack, { gap: 6, children: [_jsxs(Stack, { gap: 4, children: [_jsx("h3", { style: SECTION_HEADING_STYLE, children: text.title }), _jsxs("p", { children: [text.failoverKeyPolicyInstruction, ' ', _jsx("span", { children: _jsx(Link, { target: '_blank', rel: 'noopener noreferrer', href: urls.byokMain, children: text.dokuLink }) })] })] }), _jsx(Tile, { children: _jsxs(Stack, { gap: 4, children: [_jsx("h4", { children: cluster.isDualRegion
117
+ const hasKeyCards = !!keyStatuses && keyStatuses.keys.length > 0;
118
+ return (_jsxs(_Fragment, { children: [!hasSecondaryCard && secondaryReplicationWarning, _jsx(C4InlineNotification, { style: { maxWidth: '100%', width: '100%', marginBottom: '24px' }, lowContrast: true, kind: 'warning', title: text.failoverKeyPolicyTitle, subtitle: text.failoverKeyPolicyText, hideCloseButton: true }), _jsxs(Stack, { gap: 6, children: [_jsxs(Stack, { gap: 4, children: [_jsx("h3", { style: SECTION_HEADING_STYLE, children: text.title }), _jsxs("p", { children: [text.failoverKeyPolicyInstruction, ' ', _jsx("span", { children: _jsx(Link, { target: '_blank', rel: 'noopener noreferrer', href: urls.byokMain, children: text.dokuLink }) })] })] }), _jsx(Tile, { children: _jsxs(Stack, { gap: 4, children: [_jsx("h4", { children: cluster.isDualRegion
102
119
  ? `${text.failoverKeyPolicyPrimaryTitle} (${cluster.region})`
103
- : text.failoverKeyPolicyPrimaryTitle }), _jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: text.failoverKeyPolicyClusterRole }), _jsx(CodeSnippet, { type: 'single', children: failoverKeyPolicy.clusterRole })] }), _jsx("p", { children: text.failoverKeyPolicyStatementInstruction }), failoverCloneRolePolicyStatement && (_jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: text.failoverKeyPolicyStatementLabel }), _jsx(CodeSnippet, { type: 'multi', wrapText: true, maxCollapsedNumberOfRows: 20, children: failoverCloneRolePolicyStatement })] }))] }) }), cluster.isDualRegion && cluster.backupRegion && (_jsx(Tile, { children: _jsxs(Stack, { gap: 4, children: [_jsxs("h4", { children: [text.failoverKeyPolicySecondaryTitle, " (", cluster.backupRegion, ")"] }), _jsx("p", { children: text.failoverKeyPolicySecondaryInstruction }), _jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: text.failoverKeyPolicyClusterRole }), _jsx(CodeSnippet, { type: 'single', children: failoverKeyPolicy.clusterRole })] })] }) }))] })] }));
120
+ : text.failoverKeyPolicyPrimaryTitle }), _jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: text.failoverKeyPolicyClusterRole }), _jsx(CodeSnippet, { type: 'single', children: failoverKeyPolicy.clusterRole })] }), _jsx("p", { children: text.failoverKeyPolicyStatementInstruction }), failoverCloneRolePolicyStatement && (_jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: text.failoverKeyPolicyStatementLabel }), _jsx(CodeSnippet, { type: 'multi', wrapText: true, maxCollapsedNumberOfRows: 20, children: failoverCloneRolePolicyStatement })] }))] }) }), cluster.isDualRegion && cluster.backupRegion && (_jsx(Tile, { children: _jsxs(Stack, { gap: 4, children: [_jsxs("h4", { children: [text.failoverKeyPolicySecondaryTitle, " (", cluster.backupRegion, ")"] }), _jsx("p", { children: text.failoverKeyPolicySecondaryInstruction }), _jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: text.failoverKeyPolicyClusterRole }), _jsx(CodeSnippet, { type: 'single', children: failoverKeyPolicy.clusterRole })] })] }) })), hasKeyCards && (_jsx(C4EncryptionKeyStatus, { keys: keyStatuses.keys, tenantRoleArn: cluster.accountId ?? '', docsUrl: keyStatuses.docsUrl }))] })] }));
104
121
  }
105
122
  return (_jsxs(_Fragment, { children: [secondaryReplicationWarning, encryption.actionRequired && (_jsx(C4InlineNotification, { style: {
106
123
  maxWidth: '100%',
@@ -1,4 +1,5 @@
1
1
  import type { EncryptionStatus, FailoverKeyPolicyPrincipals } from '@camunda/ccma-shared-types';
2
+ import type { KeyStatus } from '../c4-encryption-key-status/c4-encryption-key-status.types.js';
2
3
  export interface C4ClusterDetailsEncryptionProps {
3
4
  cluster: ClusterEncryptionData;
4
5
  encryption: EncryptionFormData;
@@ -21,6 +22,16 @@ export interface C4ClusterDetailsEncryptionProps {
21
22
  * both a normal cluster and a failover target.
22
23
  */
23
24
  secondaryReplicationNotReady?: boolean;
25
+ /**
26
+ * The status of each external key, from the PrimaryKeyReady and
27
+ * SecondaryKeyReady conditions. When set, the key cards replace the ARN
28
+ * rows. Left out when the operator reports no key status or the flag is off.
29
+ */
30
+ keyStatuses?: {
31
+ keys: KeyStatus[];
32
+ /** The docs section that explains each key status. */
33
+ docsUrl: string;
34
+ };
24
35
  scripts: {
25
36
  cliScript: string;
26
37
  keyPolicy: string;
@@ -0,0 +1,12 @@
1
+ import type { JSX } from 'react';
2
+ import type { C4EncryptionKeyStatusProps } from './c4-encryption-key-status.types.js';
3
+ /**
4
+ * C4EncryptionKeysSummary is one status line for all keys: the status of the
5
+ * key in the worst state, named when the keys differ. `keys` must not be empty.
6
+ */
7
+ export declare const C4EncryptionKeysSummary: ({ keys, tenantRoleArn, }: Pick<C4EncryptionKeyStatusProps, "keys" | "tenantRoleArn">) => JSX.Element;
8
+ /**
9
+ * One card per external key, with its status. A key that Camunda cannot use
10
+ * holds its guidance in a notification inside its card.
11
+ */
12
+ export declare const C4EncryptionKeyStatus: (props: C4EncryptionKeyStatusProps) => JSX.Element;
@@ -0,0 +1,141 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, 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 { isEncryptionKeyStatusReason, needsKeyOwnerAction, } from '@camunda/ccma-shared-types';
8
+ import { CircleCheck, CircleX, LockKeyhole, TriangleAlert } from 'lucide-react';
9
+ import { CodeSnippet, Link, ListItem, Stack, Tile, UnorderedList, } from '../../ui/index.js';
10
+ import { DS_STATUS_ICON_COLORS, SpinningLoader, } from '../c4-cluster-overview/ds-status-icon-text.js';
11
+ import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
12
+ const keyName = (key) => key.key === 'primary' ? 'primary key' : 'secondary key';
13
+ // Undefined for a reason that Console does not know: the card then shows only
14
+ // the condition message.
15
+ const copyFor = (key, tenantRoleArn) => {
16
+ const name = keyName(key);
17
+ const copy = {
18
+ ExternalEncryptionKeyNotSupplied: {
19
+ title: 'Camunda is applying your key',
20
+ text: `Camunda has not applied your ${name} yet. This usually takes a few minutes.`,
21
+ },
22
+ Pending: {
23
+ title: 'Camunda is checking your key',
24
+ text: `Camunda is checking that it can use your ${name}. This usually takes a few minutes.`,
25
+ },
26
+ KeyAccessDenied: {
27
+ title: 'Camunda is not allowed to use your key',
28
+ text: (_jsxs(_Fragment, { children: ["AWS KMS denied a request from Camunda to your ", name, ". The key policy must allow the tenant role of this cluster,", ' ', _jsx(CodeSnippet, { type: 'inline', children: tenantRoleArn }), ", to use the key and to create grants on it."] })),
29
+ recentlyChanged: 'If you just changed the key policy, wait a few minutes. AWS KMS can take several minutes to apply a policy change, so this status usually clears within 10 minutes.',
30
+ checksLabel: 'What to check',
31
+ checks: [
32
+ 'The key policy contains both Camunda statements from the key policy template, with the tenant role ARN above: "Allow Camunda tenant IAM Role basic key access" and "Allow Camunda tenant IAM Role to create grants for provisioning encrypted EBS volumes".',
33
+ 'No resource control policy in your AWS organization denies the tenant role access to the key.',
34
+ 'AWS CloudTrail, in the account and Region of the key, shows the denied request and the policy that denied it.',
35
+ 'The ARN shown here points to an existing key. AWS KMS gives the same denial for a key that does not exist. If the key was deleted, AWS cannot restore it, and Camunda cannot recover the data it encrypts.',
36
+ ],
37
+ footer: 'If the key policy is correct and nothing in your organization denies the request, contact Camunda support.',
38
+ },
39
+ KeyNotUsable: {
40
+ title: 'Your key cannot be used',
41
+ text: `Your ${name} exists, but AWS KMS cannot use it for Camunda's request.`,
42
+ recentlyChanged: 'If you just changed the key, wait a few minutes. AWS KMS can take several minutes to apply a change, so this status usually clears within 10 minutes.',
43
+ checksLabel: 'What to check',
44
+ checks: [
45
+ 'The key is enabled. If it is scheduled for deletion, cancel the deletion, then enable the key.',
46
+ 'The key is a symmetric key for encryption and decryption. In the AWS KMS console, the key type is "Symmetric" and the key usage is "Encrypt and decrypt".',
47
+ 'The key has not reached its AWS KMS quota for grants.',
48
+ ],
49
+ },
50
+ KeyNotEnabled: {
51
+ title: 'Your key is disabled',
52
+ text: `Your ${name} is disabled or scheduled for deletion. The cluster cannot read or write its data until the key is enabled again.`,
53
+ checksLabel: 'What to do',
54
+ checks: [
55
+ 'Enable the key in AWS KMS. If it is scheduled for deletion, cancel the deletion first, then enable the key. The cluster recovers by itself after the key is enabled. AWS KMS can take several minutes to apply the change, so this status usually clears within 10 minutes.',
56
+ ],
57
+ },
58
+ ProviderUnavailable: {
59
+ title: 'AWS KMS is temporarily unavailable',
60
+ text: "AWS KMS did not answer Camunda's request in time, or it limited the rate of requests. Camunda retries automatically. You do not need to do anything.",
61
+ footer: 'If this status stays for more than one hour, contact Camunda support.',
62
+ },
63
+ InternalError: {
64
+ title: 'Camunda cannot check your key',
65
+ text: `A problem on Camunda's side stops Camunda from checking your ${name}. You do not need to do anything.`,
66
+ footer: 'If this status stays for more than one hour, contact Camunda support.',
67
+ },
68
+ };
69
+ const reason = key.reason;
70
+ if (!isEncryptionKeyStatusReason(reason)) {
71
+ return undefined;
72
+ }
73
+ return reason === 'Ready' ? { title: 'Ready', text: undefined } : copy[reason];
74
+ };
75
+ const isInProgress = (reason) => reason === 'Pending' || reason === 'ExternalEncryptionKeyNotSupplied';
76
+ const severity = (reason) => {
77
+ if (reason === 'Ready')
78
+ return 0;
79
+ if (isInProgress(reason))
80
+ return 1;
81
+ if (needsKeyOwnerAction(reason))
82
+ return 3;
83
+ return 2;
84
+ };
85
+ const statusLine = (key, tenantRoleArn, prefix = '') => {
86
+ const title = prefix + (copyFor(key, tenantRoleArn)?.title ?? (key.message || key.reason));
87
+ let icon;
88
+ if (key.reason === 'Ready') {
89
+ icon = _jsx(CircleCheck, { size: 16, color: DS_STATUS_ICON_COLORS.success });
90
+ }
91
+ else if (isInProgress(key.reason)) {
92
+ icon = _jsx(SpinningLoader, { size: 16, "aria-hidden": true });
93
+ }
94
+ else if (needsKeyOwnerAction(key.reason)) {
95
+ icon = _jsx(CircleX, { size: 16, color: DS_STATUS_ICON_COLORS.danger });
96
+ }
97
+ else {
98
+ icon = _jsx(TriangleAlert, { size: 16, color: DS_STATUS_ICON_COLORS.warning });
99
+ }
100
+ return (_jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '0.5rem' }, children: [icon, title] }));
101
+ };
102
+ const notificationKind = (reason) => {
103
+ if (needsKeyOwnerAction(reason))
104
+ return 'error';
105
+ return isInProgress(reason) ? 'info' : 'warning';
106
+ };
107
+ const detailLine = (message) => (_jsxs("p", { style: {
108
+ color: 'var(--muted-foreground)',
109
+ fontSize: '0.75rem',
110
+ marginTop: '0.5rem',
111
+ }, children: ["Details: ", _jsx("code", { children: message })] }));
112
+ const guidance = (key, copy, docsUrl) => {
113
+ return (_jsxs(Stack, { gap: 3, children: [_jsx("p", { children: copy.text }), copy.recentlyChanged && _jsx("p", { children: copy.recentlyChanged }), copy.checks && (_jsxs(_Fragment, { children: [_jsx("strong", { children: copy.checksLabel }), _jsx(UnorderedList, { style: { listStylePosition: 'outside', paddingLeft: '1.25rem' }, children: copy.checks.map((check) => (_jsx(ListItem, { children: check }, check))) })] })), copy.footer && _jsx("p", { children: copy.footer }), key.message && detailLine(key.message), _jsx(Link, { href: docsUrl, target: '_blank', children: "Learn more about key statuses" })] }));
114
+ };
115
+ const keyLabel = (key) => key.key === 'primary' ? 'Primary key' : 'Secondary key';
116
+ /**
117
+ * C4EncryptionKeysSummary is one status line for all keys: the status of the
118
+ * key in the worst state, named when the keys differ. `keys` must not be empty.
119
+ */
120
+ export const C4EncryptionKeysSummary = ({ keys, tenantRoleArn, }) => {
121
+ const worst = keys.reduce((a, b) => severity(b.reason) > severity(a.reason) ? b : a);
122
+ const same = keys.every((key) => key.reason === worst.reason);
123
+ return statusLine(worst, tenantRoleArn, same ? '' : `${keyLabel(worst)}: `);
124
+ };
125
+ /**
126
+ * One card per external key, with its status. A key that Camunda cannot use
127
+ * holds its guidance in a notification inside its card.
128
+ */
129
+ export const C4EncryptionKeyStatus = (props) => (_jsxs(Stack, { gap: 5, children: [_jsx("h4", { style: { fontWeight: 600 }, children: "Keys" }), props.keys.map((key) => {
130
+ const copy = copyFor(key, props.tenantRoleArn);
131
+ return (_jsx(Tile, { children: _jsxs(Stack, { gap: 4, children: [_jsxs("div", { style: {
132
+ display: 'flex',
133
+ justifyContent: 'space-between',
134
+ alignItems: 'center',
135
+ }, children: [_jsxs("span", { style: {
136
+ display: 'inline-flex',
137
+ gap: '0.5rem',
138
+ alignItems: 'center',
139
+ fontWeight: 600,
140
+ }, children: [_jsx(LockKeyhole, { size: 16, "aria-hidden": true }), keyLabel(key), " \u00B7 ", key.region] }), statusLine(key, props.tenantRoleArn)] }), _jsx(CodeSnippet, { type: 'single', children: key.arn }), key.reason !== 'Ready' && copy && (_jsx(C4InlineNotification, { kind: notificationKind(key.reason), title: copy.title, hideCloseButton: true, style: { maxWidth: '100%' }, children: guidance(key, copy, props.docsUrl) }))] }) }, key.key));
141
+ })] }));
@@ -0,0 +1,16 @@
1
+ import type { EncryptionKey } from '@camunda/ccma-shared-types';
2
+ export interface KeyStatus {
3
+ key: EncryptionKey;
4
+ region: string;
5
+ arn: string;
6
+ /** A reason of `EncryptionKeyStatusReason`, or one that Console does not know. */
7
+ reason: string;
8
+ /** The message of the condition, shown as the details line. */
9
+ message: string;
10
+ }
11
+ export interface C4EncryptionKeyStatusProps {
12
+ keys: KeyStatus[];
13
+ tenantRoleArn: string;
14
+ /** The docs section that explains each key status. */
15
+ docsUrl: string;
16
+ }
@@ -0,0 +1,6 @@
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
+ export {};
@@ -42,6 +42,7 @@ export declare const C4_EXTERNAL_URLS: {
42
42
  readonly cliScript: {
43
43
  readonly learnMore: "https://docs.camunda.io/docs/components/saas/byok/aws-external-encryption-setup/#option-a-create-the-key-using-aws-cli";
44
44
  };
45
+ readonly keyStatuses: "https://docs.camunda.io/docs/components/saas/byok/key-state-behavior/#key-statuses";
45
46
  };
46
47
  readonly clusters: {
47
48
  readonly autoPause: "https://docs.camunda.io/p/cluster-auto-pause";
@@ -41,6 +41,7 @@ export const C4_EXTERNAL_URLS = {
41
41
  cliScript: {
42
42
  learnMore: 'https://docs.camunda.io/docs/components/saas/byok/aws-external-encryption-setup/#option-a-create-the-key-using-aws-cli',
43
43
  },
44
+ keyStatuses: 'https://docs.camunda.io/docs/components/saas/byok/key-state-behavior/#key-statuses',
44
45
  },
45
46
  clusters: {
46
47
  autoPause: 'https://docs.camunda.io/p/cluster-auto-pause',
@@ -124,6 +125,8 @@ export function getC4ClusterDetailsUrls(urls) {
124
125
  C4_EXTERNAL_URLS.docs.byok.cliScript.learnMore,
125
126
  encryptionManual: urls.docs?.encryptionManual ??
126
127
  C4_EXTERNAL_URLS.docs.byok.learnMoreAboutCreatingKmsKey,
128
+ encryptionKeyStatuses: urls.docs?.encryptionKeyStatuses ??
129
+ C4_EXTERNAL_URLS.docs.byok.keyStatuses,
127
130
  identityDocsUrl: urls.docs?.identityDocsUrl ?? C4_EXTERNAL_URLS.docs.introToIdentity,
128
131
  support: urls.docs?.support ?? C4_EXTERNAL_URLS.help.enterpriseSupport,
129
132
  contact: urls.docs?.contact ?? C4_EXTERNAL_URLS.camunda.contact,
@@ -103,6 +103,8 @@ export type { C4DeleteOrganizationModalProps } from './components/c4-delete-orga
103
103
  export { C4Divider } from './components/c4-divider/c4-divider.js';
104
104
  export type { C4DividerProps } from './components/c4-divider/c4-divider.types.js';
105
105
  export { C4EmptyState, type C4EmptyStateProps, } from './components/c4-empty-state/c4-empty-state.js';
106
+ export { C4EncryptionKeyStatus, C4EncryptionKeysSummary, } from './components/c4-encryption-key-status/c4-encryption-key-status.js';
107
+ export type { C4EncryptionKeyStatusProps, KeyStatus, } from './components/c4-encryption-key-status/c4-encryption-key-status.types.js';
106
108
  export { C4ExtendTrialModal } from './components/c4-extend-trial-modal/c4-extend-trial-modal.js';
107
109
  export type { C4ExtendTrialModalProps } from './components/c4-extend-trial-modal/c4-extend-trial-modal.types.js';
108
110
  export { C4ExternalLink } from './components/c4-external-link/c4-external-link.js';
package/lib/esm/index.js CHANGED
@@ -57,6 +57,7 @@ export { C4DeleteAccountModal } from './components/c4-delete-account-modal/c4-de
57
57
  export { C4DeleteOrganizationModal } from './components/c4-delete-organization-modal/c4-delete-organization-modal.js';
58
58
  export { C4Divider } from './components/c4-divider/c4-divider.js';
59
59
  export { C4EmptyState, } from './components/c4-empty-state/c4-empty-state.js';
60
+ export { C4EncryptionKeyStatus, C4EncryptionKeysSummary, } from './components/c4-encryption-key-status/c4-encryption-key-status.js';
60
61
  export { C4ExtendTrialModal } from './components/c4-extend-trial-modal/c4-extend-trial-modal.js';
61
62
  export { C4ExternalLink } from './components/c4-external-link/c4-external-link.js';
62
63
  export { C4FeedbackForm, C4FeedbackModal, } from './components/c4-feedback-modal/c4-feedback-modal.js';
@@ -4,19 +4,18 @@ import type { C4ClusterDetailsAppProps } from './c4-cluster-details-app.types.js
4
4
  export declare function mergeNestedSnapshot<T>(previous: T | undefined, next: T): T;
5
5
  /**
6
6
  * True when this is a dual-region BYOK cluster and the secondary region's
7
- * key is not accessible. Exported (and kept pure) so both the header
8
- * indicator and the Encryption tab's own warning read the same computation,
9
- * and so this can be tested without rendering the full component.
7
+ * key is not accessible.
10
8
  *
11
- * Gated on `encryption === 'External'` to match the Encryption tab's own
12
- * visibility (`tab.visible` below) — otherwise the header indicator could
13
- * tell the customer to click through to a tab that is not shown.
9
+ * With `keyStatusEnabled` and a reported PrimaryKeyReady, it reads
10
+ * SecondaryKeyReady, the condition of the secondary key card, and is true
11
+ * only when the key owner must act. Pass the flag that the Encryption tab
12
+ * gets, so the header and the cards agree.
14
13
  */
15
14
  export declare function computeSecondaryReplicationNotReady(cluster: Pick<ConsoleClusterDto, 'encryption' | 'backupRegionCodes'> & {
16
15
  status?: {
17
16
  conditions?: Parameters<typeof deriveSecondaryStorageStatus>[0];
18
17
  };
19
- }): boolean;
18
+ }, keyStatusEnabled?: boolean): boolean;
20
19
  export declare function ensureClusterLoadPerDay(perDay: HdpPrometheusDataCapacityDataPoint[]): HdpPrometheusDataCapacityDataPoint[];
21
20
  export declare function ensureClusterLoad24h(last24h: HdpPrometheusDataCapacityDataPoint[]): HdpPrometheusDataCapacityDataPoint[];
22
21
  export declare const C4ClusterDetailsApp: ((props: C4ClusterDetailsAppProps) => JSX.Element) & {
@@ -5,7 +5,7 @@ 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, SalesPlanType, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
8
+ import { AUDIT_LOG_TAB_MIN_VERSION, CLUSTER_STATISTICS_CONFIG_MIN_VERSION, checkVersion, deriveEncryptionKeyStatus, deriveEncryptionStatus, deriveSecondaryStorageStatus, needsKeyOwnerAction, 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
11
  import { C4ClusterMigration } from '../../components/c4-cluster-migration/c4-cluster-migration.js';
@@ -127,19 +127,29 @@ export function mergeNestedSnapshot(previous, next) {
127
127
  }
128
128
  /**
129
129
  * True when this is a dual-region BYOK cluster and the secondary region's
130
- * key is not accessible. Exported (and kept pure) so both the header
131
- * indicator and the Encryption tab's own warning read the same computation,
132
- * and so this can be tested without rendering the full component.
130
+ * key is not accessible.
133
131
  *
134
- * Gated on `encryption === 'External'` to match the Encryption tab's own
135
- * visibility (`tab.visible` below) — otherwise the header indicator could
136
- * tell the customer to click through to a tab that is not shown.
132
+ * With `keyStatusEnabled` and a reported PrimaryKeyReady, it reads
133
+ * SecondaryKeyReady, the condition of the secondary key card, and is true
134
+ * only when the key owner must act. Pass the flag that the Encryption tab
135
+ * gets, so the header and the cards agree.
137
136
  */
138
- export function computeSecondaryReplicationNotReady(cluster) {
139
- return (cluster.encryption === 'External' &&
140
- (cluster.backupRegionCodes?.length ?? 0) > 1 &&
141
- deriveSecondaryStorageStatus(cluster.status?.conditions) ===
142
- 'SecondaryEncryptionNotReady');
137
+ export function computeSecondaryReplicationNotReady(cluster, keyStatusEnabled = false) {
138
+ // Only External clusters show the Encryption tab (`tab.visible` below), and
139
+ // the header must not send the customer to a tab that is not shown.
140
+ if (cluster.encryption !== 'External' ||
141
+ (cluster.backupRegionCodes?.length ?? 0) <= 1) {
142
+ return false;
143
+ }
144
+ const conditions = cluster.status?.conditions;
145
+ if (keyStatusEnabled &&
146
+ deriveEncryptionKeyStatus(conditions, 'primary') !== undefined) {
147
+ // SecondaryStorageReady is also not ready while the secondary bucket is
148
+ // provisioned or syncs, which is no key problem.
149
+ const secondary = deriveEncryptionKeyStatus(conditions, 'secondary');
150
+ return secondary !== undefined && needsKeyOwnerAction(secondary.reason);
151
+ }
152
+ return (deriveSecondaryStorageStatus(conditions) === 'SecondaryEncryptionNotReady');
143
153
  }
144
154
  // Client-side dismissal of the "restore failed" banner. The failed state is
145
155
  // derived from the Restore CR, so there is no server-side "seen" flag — we
@@ -1413,14 +1423,16 @@ export const C4ClusterDetailsApp = observer((props) => {
1413
1423
  // A failover target with a pending key-policy update needs the customer
1414
1424
  // in the Encryption tab, not Overview — Overview has nothing that tells
1415
1425
  // them a key policy update is needed.
1426
+ const encryptionStatus = deriveEncryptionStatus(cluster?.status?.conditions);
1416
1427
  const needsFailoverEncryptionAction = isFailoverTarget &&
1417
- deriveEncryptionStatus(cluster?.status?.conditions) ===
1418
- 'ExternalEncryptionKeyNotReady';
1428
+ (encryptionStatus === 'ExternalEncryptionKeyNotReady' ||
1429
+ encryptionStatus === 'ExternalEncryptionKeyGrantNotReady');
1419
1430
  // Computed once here (not inside the Encryption tab) because the header
1420
1431
  // indicator needs it too, and the two must never disagree about whether
1421
1432
  // there's a problem.
1433
+ const keyStatusEnabled = runtime.featureFlags?.isEnabled?.('console.byokKeyStatus') ?? false;
1422
1434
  const secondaryReplicationNotReady = cluster
1423
- ? computeSecondaryReplicationNotReady(cluster)
1435
+ ? computeSecondaryReplicationNotReady(cluster, keyStatusEnabled)
1424
1436
  : false;
1425
1437
  // Guards on needsFailoverEncryptionAction itself, not on "cluster has
1426
1438
  // loaded" — the operator can report the condition after the first
@@ -1462,10 +1474,11 @@ export const C4ClusterDetailsApp = observer((props) => {
1462
1474
  // Only a change of `desiredTabId` runs this. The other values are read
1463
1475
  // at that time.
1464
1476
  }, [props.desiredTabId]);
1465
- 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, secondaryReplicationNotReady: secondaryReplicationNotReady, docsUrls: {
1477
+ 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, secondaryReplicationNotReady: secondaryReplicationNotReady, keyStatusEnabled: keyStatusEnabled, docsUrls: {
1466
1478
  encryption: urls.docs.encryption,
1467
1479
  encryptionCli: urls.docs.encryptionCli,
1468
1480
  encryptionManual: urls.docs.encryptionManual,
1481
+ encryptionKeyStatuses: urls.docs.encryptionKeyStatuses,
1469
1482
  } }));
1470
1483
  const tabs = useMemo(() => {
1471
1484
  // Labels come from the shared cluster-details tab catalog (single source
@@ -112,6 +112,7 @@ export interface C4ClusterDetailsDocsUrls {
112
112
  encryption: string;
113
113
  encryptionCli: string;
114
114
  encryptionManual: string;
115
+ encryptionKeyStatuses: string;
115
116
  identityDocsUrl: string;
116
117
  support: string;
117
118
  contact: string;
@@ -145,6 +146,7 @@ export interface C4ClusterDetailsUrls {
145
146
  encryption?: string;
146
147
  encryptionCli?: string;
147
148
  encryptionManual?: string;
149
+ encryptionKeyStatuses?: string;
148
150
  identityDocsUrl?: string;
149
151
  support?: string;
150
152
  contact?: string;
@@ -20,10 +20,13 @@ interface C4ClusterDetailsEncryptionTabProps {
20
20
  * disagree about whether there's a problem.
21
21
  */
22
22
  secondaryReplicationNotReady?: boolean;
23
+ /** The `console.byokKeyStatus` flag: show a status for each key. */
24
+ keyStatusEnabled?: boolean;
23
25
  docsUrls: {
24
26
  encryption: string;
25
27
  encryptionCli: string;
26
28
  encryptionManual: string;
29
+ encryptionKeyStatuses: string;
27
30
  };
28
31
  }
29
32
  export declare const C4ClusterDetailsEncryptionTab: (props: C4ClusterDetailsEncryptionTabProps) => JSX.Element;
@@ -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, deriveFailoverKeyPolicyPrincipals, } from '@camunda/ccma-shared-types';
3
+ import { deriveEncryptionKeyStatus, 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
@@ -37,7 +37,7 @@ function buildCloneRolePolicyStatement(cloneRoleArn) {
37
37
  }, null, 2);
38
38
  }
39
39
  export const C4ClusterDetailsEncryptionTab = (props) => {
40
- const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, isFailoverTarget, secondaryReplicationNotReady, docsUrls, } = props;
40
+ const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, isFailoverTarget, secondaryReplicationNotReady, keyStatusEnabled, docsUrls, } = props;
41
41
  // BYOK script content
42
42
  const [byokCliSingle, setByokCliSingle] = useState('');
43
43
  const [byokCliDual, setByokCliDual] = useState('');
@@ -140,11 +140,38 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
140
140
  };
141
141
  // Render templates with cluster-specific values
142
142
  const tenantRoleArn = cluster?.status?.accountId ?? '';
143
+ // The status of each key. The cards show only when the operator reports the
144
+ // primary key's status. Otherwise the tab falls back to EncryptionReady.
145
+ const keys = [];
146
+ const primaryKeyStatus = deriveEncryptionKeyStatus(cluster?.status?.conditions, 'primary');
147
+ if (keyStatusEnabled && primaryKeyStatus && primaryEncryptionKeyId) {
148
+ keys.push({
149
+ key: 'primary',
150
+ region: clusterRegion,
151
+ arn: primaryEncryptionKeyId,
152
+ reason: primaryKeyStatus.reason,
153
+ message: primaryKeyStatus.message,
154
+ });
155
+ const secondaryKeyStatus = deriveEncryptionKeyStatus(cluster?.status?.conditions, 'secondary');
156
+ if (isDualRegion && secondaryEncryptionKeyId) {
157
+ // The operator sets SecondaryKeyReady only once the cluster spec has
158
+ // the secondary key, which can lag behind the ARN that Console saved.
159
+ keys.push({
160
+ key: 'secondary',
161
+ region: backupRegion,
162
+ arn: secondaryEncryptionKeyId,
163
+ reason: secondaryKeyStatus?.reason ?? 'ExternalEncryptionKeyNotSupplied',
164
+ message: secondaryKeyStatus?.message ?? '',
165
+ });
166
+ }
167
+ }
143
168
  // For a failed-over cluster, the three principals in the failover region
144
169
  // that need access to the (already configured) keys. All are derived from
145
170
  // the cluster's own role ARN plus the stableId carried over from its
146
171
  // source, so nothing has to be persisted or fetched separately.
147
- const failoverKeyPolicy = isFailoverTarget && encryptionStatus === 'ExternalEncryptionKeyNotReady'
172
+ const failoverKeyPolicy = isFailoverTarget &&
173
+ (encryptionStatus === 'ExternalEncryptionKeyNotReady' ||
174
+ encryptionStatus === 'ExternalEncryptionKeyGrantNotReady')
148
175
  ? deriveFailoverKeyPolicyPrincipals(tenantRoleArn, cluster?.stableId)
149
176
  : undefined;
150
177
  const failoverCloneRolePolicyStatement = failoverKeyPolicy
@@ -213,7 +240,9 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
213
240
  isDualRegion,
214
241
  status: encryptionStatus,
215
242
  accountId: tenantRoleArn,
216
- }, encryption: encryption, failoverKeyPolicy: failoverKeyPolicy, failoverCloneRolePolicyStatement: failoverCloneRolePolicyStatement, secondaryReplicationNotReady: secondaryReplicationNotReady, scripts: {
243
+ }, encryption: encryption, failoverKeyPolicy: failoverKeyPolicy, failoverCloneRolePolicyStatement: failoverCloneRolePolicyStatement, secondaryReplicationNotReady: secondaryReplicationNotReady, keyStatuses: keys.length > 0
244
+ ? { keys, docsUrl: docsUrls.encryptionKeyStatuses }
245
+ : undefined, scripts: {
217
246
  cliScript: renderedCli,
218
247
  keyPolicy: renderedPolicy,
219
248
  }, text: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.28.9",
3
+ "version": "0.29.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": "7.11.2",
89
- "@camunda/ccma-shared-types": "13.0.0",
88
+ "@camunda/ccma-api": "7.11.3",
89
+ "@camunda/ccma-shared-types": "13.1.0",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",
92
92
  "mobx": "6.16.1",