@camunda/ccma-saas-frontend 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js +1 -1
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.types.d.ts +1 -0
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.d.ts +1 -1
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.js +14 -6
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.types.d.ts +1 -0
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.d.ts +1 -1
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js +21 -6
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.types.d.ts +17 -0
- package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.d.ts +3 -0
- package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js +51 -0
- package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.types.d.ts +24 -0
- package/lib/esm/components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.types.js +6 -0
- package/lib/esm/components/c4-cluster-overview/applications.d.ts +1 -1
- package/lib/esm/components/c4-cluster-overview/applications.js +7 -0
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.js +1 -1
- package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +1 -1
- package/lib/esm/components/c4-cluster-overview/cluster-details.js +1 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +1 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.spec.js +4 -0
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.d.ts +1 -1
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.js +3 -5
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.types.d.ts +1 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.d.ts +2 -3
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.js +2 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-piechart.d.ts +2 -3
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-piechart.js +2 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-time-chart.d.ts +2 -3
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-time-chart.js +2 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.d.ts +2 -3
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.js +2 -2
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.d.ts +1 -1
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.js +2 -2
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.types.d.ts +1 -2
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.d.ts +1 -1
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.js +4 -5
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.types.d.ts +1 -2
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-error-handler.d.ts +2 -3
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-error-handler.js +4 -3
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-shared.types.d.ts +0 -4
- package/lib/esm/externalUrls.const.d.ts +2 -4
- package/lib/esm/externalUrls.const.js +2 -14
- package/lib/esm/externalUrls.const.spec.js +0 -9
- package/lib/esm/i18n/en/modals/clusterclients.json +8 -0
- package/lib/esm/i18n/en/modals/clusters.json +4 -1
- package/lib/esm/i18n/en/pages/clusterdetails.json +34 -4
- package/lib/esm/index.css +257 -0
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +27 -1
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +41 -33
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.permissions.spec.js +52 -12
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +0 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.d.ts +1 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +19 -20
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.spec.js +53 -35
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +11 -26
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +13 -12
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +104 -3
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.spec.js +16 -15
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +1 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +111 -34
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +121 -5
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +4 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.spec.js +4 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.js +3 -2
- package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.js +3 -2
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.d.ts +1 -0
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +20 -1
- package/lib/esm/widgets/job-worker/c4-job-worker-details-page.d.ts +1 -1
- package/lib/esm/widgets/job-worker/c4-job-worker-details-page.js +2 -2
- package/lib/esm/widgets/job-worker/c4-job-worker-overview-page.d.ts +1 -1
- package/lib/esm/widgets/job-worker/c4-job-worker-overview-page.js +2 -2
- package/lib/esm/widgets/job-worker/c4-job-worker.types.d.ts +0 -3
- package/lib/esm/widgets/management/c4-management-app.js +1 -1
- package/package.json +31 -26
- package/lib/esm/index.scss +0 -267
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.spec.d.ts +0 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.spec.js +0 -55
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { C3EmptyState } from '@camunda/camunda-composite-components';
|
|
8
2
|
import { ConsoleConnectorSecretsService } from '@camunda/ccma-api';
|
|
9
3
|
import { SECRETS_MAX_LENGTH, SseEntity } from '@camunda/ccma-shared-types';
|
|
10
4
|
import { CodeSnippet, FileUploader, Form, InlineLoading, InlineNotification, Link, Modal, PasswordInput, Select, SelectItem, Stack, TextArea, TextInput, } from '@carbon/react';
|
|
11
5
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
|
-
import { C4_ASSET_URLS } from '../../../assetUrls.js';
|
|
13
6
|
import { C4ClusterDetailsConnectorSecrets } from '../../../components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js';
|
|
14
7
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
15
8
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
@@ -45,7 +38,10 @@ function renderInlineLink0(value, linkRenderer) {
|
|
|
45
38
|
return (_jsxs("span", { children: [before, linkRenderer(label), after] }));
|
|
46
39
|
}
|
|
47
40
|
export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
48
|
-
const { orgId, clusterId, apiConfig, canMutateCluster, connectorSecretsPermissions, docsUrl, t, onNavigate,
|
|
41
|
+
const { orgId, clusterId, apiConfig, canMutateCluster, connectorSecretsPermissions, docsUrl, t, onNavigate, useClusterSecretsLabel, } = props;
|
|
42
|
+
const pickSecretsText = (connectorKey, connectorFallback, clusterKey, clusterFallback) => useClusterSecretsLabel
|
|
43
|
+
? safeTranslate(t, clusterKey, clusterFallback)
|
|
44
|
+
: safeTranslate(t, connectorKey, connectorFallback);
|
|
49
45
|
const data = useC4ConsoleData();
|
|
50
46
|
const runtime = useC4ConsoleRuntime();
|
|
51
47
|
const trackEvent = useCallback((eventName, message, meta) => {
|
|
@@ -134,21 +130,17 @@ export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
|
134
130
|
}, [clusterId, connectorSecretsMap, reloadConnectorSecrets]);
|
|
135
131
|
const sseSecretsVersion = data.getSseEntityVersion(orgId, SseEntity.CONNECTOR_SECRETS, clusterId);
|
|
136
132
|
useEffect(() => {
|
|
137
|
-
if (isSecretsMovedToOrchestration)
|
|
138
|
-
return;
|
|
139
133
|
connectorSecretsLoadedRef.current = false;
|
|
140
134
|
setConnectorSecretsMap({});
|
|
141
135
|
setConnectorSecretsError(false);
|
|
142
136
|
void reloadConnectorSecrets();
|
|
143
|
-
}, [reloadConnectorSecrets
|
|
137
|
+
}, [reloadConnectorSecrets]);
|
|
144
138
|
useEffect(() => {
|
|
145
|
-
if (isSecretsMovedToOrchestration)
|
|
146
|
-
return;
|
|
147
139
|
if (!connectorSecretsLoadedRef.current) {
|
|
148
140
|
return;
|
|
149
141
|
}
|
|
150
142
|
void reloadConnectorSecrets();
|
|
151
|
-
}, [reloadConnectorSecrets, sseSecretsVersion
|
|
143
|
+
}, [reloadConnectorSecrets, sseSecretsVersion]);
|
|
152
144
|
// Secrets prefixed with 'CAMUNDA_PROVIDED_' are system-managed and should be
|
|
153
145
|
// shown as protected (hidden) — users cannot reveal, update, or delete them.
|
|
154
146
|
const secrets = Object.keys(connectorSecretsMap)
|
|
@@ -158,24 +150,16 @@ export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
|
158
150
|
key,
|
|
159
151
|
isProtected: key.startsWith('CAMUNDA_PROVIDED_'),
|
|
160
152
|
}));
|
|
161
|
-
const emptyDescription = renderInlineStrong(
|
|
162
|
-
const infoText = renderInlineLink0(
|
|
153
|
+
const emptyDescription = renderInlineStrong(pickSecretsText('clusterdetails:connectorSecrets.noSecrets.description', 'Create a connector secret to use in your connectors.', 'clusterdetails:clusterSecrets.noSecrets.description', 'Create a cluster secret to reference encrypted credentials in your cluster.'));
|
|
154
|
+
const infoText = renderInlineLink0(pickSecretsText('clusterdetails:connectorSecrets.infoText', 'Learn more about connector secrets in our <0>documentation</0>.', 'clusterdetails:clusterSecrets.infoText', 'Learn more about cluster secrets in our <0>documentation</0>.'), (label) => (_jsx(Link, { size: 'sm', href: docsUrl ?? '', onClick: (e) => {
|
|
163
155
|
e.preventDefault();
|
|
164
156
|
onNavigate?.({
|
|
165
157
|
kind: 'openUrl',
|
|
166
158
|
url: docsUrl ?? '',
|
|
167
159
|
});
|
|
168
160
|
}, children: label })));
|
|
169
|
-
if (isSecretsMovedToOrchestration) {
|
|
170
|
-
return (_jsx(C3EmptyState, { icon: {
|
|
171
|
-
path: C4_ASSET_URLS.connectorSecretIcon,
|
|
172
|
-
altText: safeTranslate(t, 'clusterdetails:connectorSecrets.secretsMovedIconAlt', 'Connector secrets icon'),
|
|
173
|
-
}, heading: safeTranslate(t, 'clusterdetails:connectorSecrets.secretsMovedHeading', 'Secrets management has moved'), description:
|
|
174
|
-
/* TBD: Replace with final copy before promoting to preprod. */
|
|
175
|
-
safeTranslate(t, 'clusterdetails:connectorSecrets.secretsMovedPlaceholder', 'Secrets management has moved to the orchestration cluster.') }));
|
|
176
|
-
}
|
|
177
161
|
return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsConnectorSecrets, { secrets: secrets, isLoading: connectorSecretsLoading, hasError: connectorSecretsError, hasImportFromClusterFeature: true, hasExportFeature: true, text: {
|
|
178
|
-
title:
|
|
162
|
+
title: pickSecretsText('clusterdetails:connectorSecrets.title', 'Connector secrets', 'clusterdetails:clusterSecrets.title', 'Cluster secrets'),
|
|
179
163
|
createButton: safeTranslate(t, 'clusterdetails:connectorSecrets.createButton', 'Create secret'),
|
|
180
164
|
bulkImportButton: safeTranslate(t, 'clusterdetails:connectorSecrets.bulkImportButton', 'Bulk import'),
|
|
181
165
|
importFromClusterButton: safeTranslate(t, 'clusterdetails:connectorSecrets.importFromClusterButton', 'Import from cluster'),
|
|
@@ -189,10 +173,11 @@ export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
|
189
173
|
errorTitle: safeTranslate(t, 'clusterdetails:connectorSecrets.fetchError.title', 'Could not load secrets'),
|
|
190
174
|
errorDescription: safeTranslate(t, 'clusterdetails:connectorSecrets.fetchError.description', 'Please try again.'),
|
|
191
175
|
errorButton: safeTranslate(t, 'clusterdetails:connectorSecrets.fetchError.button', 'Retry'),
|
|
192
|
-
emptyTitle:
|
|
176
|
+
emptyTitle: pickSecretsText('clusterdetails:connectorSecrets.noSecrets.title', 'No secrets', 'clusterdetails:clusterSecrets.noSecrets.title', 'No secrets'),
|
|
193
177
|
emptyDescription,
|
|
194
178
|
emptyCreateButton: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.button', 'Create secret'),
|
|
195
179
|
emptyLearnMoreLabel: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.link', 'Learn more'),
|
|
180
|
+
emptyIconAltText: pickSecretsText('clusterdetails:connectorSecrets.emptyIconAltText', 'Connector secrets icon', 'clusterdetails:clusterSecrets.emptyIconAltText', 'Cluster secrets icon'),
|
|
196
181
|
infoText,
|
|
197
182
|
// Label for the badge shown on CAMUNDA_PROVIDED_ secrets
|
|
198
183
|
protectedBadge: safeTranslate(t, 'clusterdetails:connectorSecrets.protectedBadge', 'Hidden'),
|
|
@@ -14,15 +14,15 @@ function isEncryptionStatus(value) {
|
|
|
14
14
|
value === 'EncryptedStorageNotReady');
|
|
15
15
|
}
|
|
16
16
|
function normalizeRegion(value) {
|
|
17
|
-
if (!value)
|
|
17
|
+
if (!value || value.trim() === '-')
|
|
18
18
|
return '';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.
|
|
25
|
-
|
|
19
|
+
// Match AWS region codes; take the LAST one so dual-region strings like
|
|
20
|
+
// "Dual region: Europe (Ireland) - (eu-west-1), Europe (London) - (eu-west-2)"
|
|
21
|
+
// return eu-west-2 (the backup), not eu-west-1 or "Ireland".
|
|
22
|
+
const codes = [...value.matchAll(/[a-z]{2,3}-[a-z]+-\d+/giu)];
|
|
23
|
+
if (codes.length > 0)
|
|
24
|
+
return codes[codes.length - 1][0].toLowerCase();
|
|
25
|
+
return value.trim();
|
|
26
26
|
}
|
|
27
27
|
function toIsoString(value) {
|
|
28
28
|
if (!value)
|
|
@@ -31,7 +31,7 @@ function toIsoString(value) {
|
|
|
31
31
|
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
|
32
32
|
}
|
|
33
33
|
export const C4ClusterDetailsEncryptionTab = (props) => {
|
|
34
|
-
const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, docsUrls, } = props;
|
|
34
|
+
const { cluster, orgId, clusterId, apiConfig, activeTabId, onReloadCluster, restoreInProgress, docsUrls, } = props;
|
|
35
35
|
// BYOK script content
|
|
36
36
|
const [byokCliSingle, setByokCliSingle] = useState('');
|
|
37
37
|
const [byokCliDual, setByokCliDual] = useState('');
|
|
@@ -97,8 +97,9 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
|
|
|
97
97
|
return _jsx(_Fragment, {});
|
|
98
98
|
}
|
|
99
99
|
const clusterRegion = normalizeRegion(cluster?.k8sContext?.region ?? cluster?.k8sContext?.name);
|
|
100
|
-
const
|
|
101
|
-
const
|
|
100
|
+
const backupRegionCodes = cluster?.backupRegionCodes ?? [];
|
|
101
|
+
const backupRegion = backupRegionCodes.at(-1) ?? '';
|
|
102
|
+
const isDualRegion = backupRegionCodes.length > 1;
|
|
102
103
|
const primaryEncryptionKeyId = cluster?.primaryEncryptionKeyId ?? null;
|
|
103
104
|
const secondaryEncryptionKeyId = cluster?.secondaryEncryptionKeyId ?? null;
|
|
104
105
|
// Compute encryption status from cluster conditions
|
|
@@ -246,7 +247,7 @@ export const C4ClusterDetailsEncryptionTab = (props) => {
|
|
|
246
247
|
byokMain: docsUrls.encryption,
|
|
247
248
|
cliScriptLearnMore: docsUrls.encryptionCli,
|
|
248
249
|
learnMoreAboutCreatingKmsKey: docsUrls.encryptionManual,
|
|
249
|
-
}, onSetARN: handleSetARN, onUpdatePrimaryARN: (value) => {
|
|
250
|
+
}, disabled: !!restoreInProgress, onSetARN: handleSetARN, onUpdatePrimaryARN: (value) => {
|
|
250
251
|
setPrimaryArnTouched(true);
|
|
251
252
|
setPrimaryArn(value);
|
|
252
253
|
}, onUpdateSecondaryARN: (value) => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ConsoleBackupScheduleService, ConsoleHotBackupsService, } from '@camunda/ccma-api';
|
|
3
|
-
import { checkVersion, HOTBACKUP_MIN_CREATE_PERIOD, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
3
|
+
import { BackupStatus, checkVersion, HOTBACKUP_MIN_CREATE_PERIOD, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
4
4
|
import { Checkbox, Modal, Select, SelectItem, Stack, TextInput, } from '@carbon/react';
|
|
5
5
|
import { CronExpression, CronExpressionParser, CronFieldCollection, } from 'cron-parser';
|
|
6
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { C4ClusterDetailsHotBackups } from '../../../components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js';
|
|
8
|
+
import { C4ClusterDetailsHotBackupsRestore } from '../../../components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js';
|
|
8
9
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
10
|
+
import { useC4ConsoleNotifications } from '../../../runtime/c4-console-notifications-context.js';
|
|
9
11
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
10
12
|
const WEEKDAYS = [
|
|
11
13
|
'Monday',
|
|
@@ -96,6 +98,7 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
96
98
|
const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, docsUrls, t, onNavigate, } = props;
|
|
97
99
|
const data = useC4ConsoleData();
|
|
98
100
|
const runtime = useC4ConsoleRuntime();
|
|
101
|
+
const { add: addNotification } = useC4ConsoleNotifications();
|
|
99
102
|
const trackEvent = useCallback((eventName, message, meta) => {
|
|
100
103
|
runtime.telemetry?.track?.(eventName, {
|
|
101
104
|
message,
|
|
@@ -130,6 +133,7 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
130
133
|
// Modal states
|
|
131
134
|
const [createBackupOpen, setCreateBackupOpen] = useState(false);
|
|
132
135
|
const [deleteBackupOpen, setDeleteBackupOpen] = useState(false);
|
|
136
|
+
const [restoreBackupOpen, setRestoreBackupOpen] = useState(false);
|
|
133
137
|
const [selectedBackupId, setSelectedBackupId] = useState('');
|
|
134
138
|
const [backupMutationBusy, setBackupMutationBusy] = useState(false);
|
|
135
139
|
const [backupMutationError, setBackupMutationError] = useState('');
|
|
@@ -208,6 +212,11 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
208
212
|
versionToCompareTo: '8.2.4',
|
|
209
213
|
})
|
|
210
214
|
: false;
|
|
215
|
+
// Same-cluster restore is currently dev-only. Until the operator side ships
|
|
216
|
+
// the Restore CRD on int/prod, the backend POST /restore endpoint returns 501
|
|
217
|
+
// — gate the entire UI surface on this flag so the action never reaches users
|
|
218
|
+
// who can't actually use it.
|
|
219
|
+
const isBackupRestoreEnabled = runtime.featureFlags?.isEnabled?.('console.backupRestore') ?? false;
|
|
211
220
|
const backupItems = hotBackups.map((backup) => ({
|
|
212
221
|
id: backup.uuid,
|
|
213
222
|
uuid: backup.uuid,
|
|
@@ -216,6 +225,16 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
216
225
|
type: backup.uuid.includes('on-demand') ? 'Manual' : 'Scheduled',
|
|
217
226
|
started: toDateOrDash(backup.created),
|
|
218
227
|
completed: toDateOrDash(backup.completed),
|
|
228
|
+
// Resolved server-side from the backup's `generationUuid` label. Falls
|
|
229
|
+
// back to '-' for legacy backups that pre-date the label contract.
|
|
230
|
+
version: backup.generationName ?? '-',
|
|
231
|
+
// Restore is only safe from a terminal-successful backup that carries a
|
|
232
|
+
// generationUuid label. Without the uuid the backend rejects (legacy
|
|
233
|
+
// contract); for `In progress` / `Failed` rows the data isn't a valid
|
|
234
|
+
// restore source even if a uuid was set early.
|
|
235
|
+
canRestore: isBackupRestoreEnabled &&
|
|
236
|
+
backup.status === BackupStatus.COMPLETE &&
|
|
237
|
+
Boolean(backup.generationUuid),
|
|
219
238
|
zeebeStatus: String(backup.zeebeStatus),
|
|
220
239
|
operateStatus: String(backup.operateStatus),
|
|
221
240
|
tasklistStatus: String(backup.tasklistStatus),
|
|
@@ -256,6 +275,12 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
256
275
|
headerStarted: 'Started at',
|
|
257
276
|
headerCompleted: 'Completed at',
|
|
258
277
|
deleteAction: safeTranslate(t, 'clusterdetails:hotbackups.deleteButton', 'Delete'),
|
|
278
|
+
expansionVersionLabel: safeTranslate(t, 'clusterdetails:hotbackups.expansionVersionLabel', 'Version'),
|
|
279
|
+
restoreAction: safeTranslate(t, 'clusterdetails:hotbackups.restoreAction', 'Restore'),
|
|
280
|
+
restoreInProgressTitle: safeTranslate(t, 'clusterdetails:hotbackups.restoreInProgressTitle', 'Restoring "{backupName}"'),
|
|
281
|
+
restoreInProgressText: safeTranslate(t, 'clusterdetails:hotbackups.restoreInProgressText', "You can't start another backup or restore while this is in progress."),
|
|
282
|
+
restoreErrorTitle: safeTranslate(t, 'clusterdetails:hotbackups.restoreErrorTitle', 'Restore failed'),
|
|
283
|
+
restoreErrorMessage: safeTranslate(t, 'clusterdetails:hotbackups.restoreErrorMessage', 'Restore of "{backupName}" did not complete. Your cluster is unchanged. Contact support if the issue persists.'),
|
|
259
284
|
errorTitle: safeTranslate(t, 'clusterdetails:hotbackups.fetchError.title', 'Oops ... something went wrong.'),
|
|
260
285
|
errorDescription: safeTranslate(t, 'clusterdetails:hotbackups.fetchError.description', 'Please try reloading!'),
|
|
261
286
|
errorButton: safeTranslate(t, 'clusterdetails:hotbackups.fetchError.button', 'Reload'),
|
|
@@ -287,8 +312,17 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
287
312
|
support: docsUrls.support,
|
|
288
313
|
talkToExpert: docsUrls.contact,
|
|
289
314
|
}, permissions: {
|
|
290
|
-
|
|
315
|
+
// Create + Restore conflict with an in-flight restore (cluster is
|
|
316
|
+
// unavailable for new snapshots, and only one restore may run at a
|
|
317
|
+
// time); Delete stays available — see 2135-same-cluster-restore.md.
|
|
318
|
+
// Restore is additionally feature-flagged off until the operator
|
|
319
|
+
// ships its side; per-row `canRestore` repeats this gate but the
|
|
320
|
+
// top-level flag short-circuits the whole action.
|
|
321
|
+
canCreate: canMutateCluster && !cluster?.restoreInProgress,
|
|
291
322
|
canDelete: canMutateCluster,
|
|
323
|
+
canRestore: isBackupRestoreEnabled &&
|
|
324
|
+
canMutateCluster &&
|
|
325
|
+
!cluster?.restoreInProgress,
|
|
292
326
|
}, onCreateBackup: () => {
|
|
293
327
|
if (!isHotBackupEnabled)
|
|
294
328
|
return;
|
|
@@ -304,6 +338,15 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
304
338
|
setBackupMutationError('');
|
|
305
339
|
setSelectedBackupId(backupId);
|
|
306
340
|
setDeleteBackupOpen(true);
|
|
341
|
+
}, onRestoreBackup: (backupId) => {
|
|
342
|
+
if (!isHotBackupEnabled)
|
|
343
|
+
return;
|
|
344
|
+
trackEvent('listBackups:restore:open', 'Open Restore Backup Modal', {
|
|
345
|
+
backupId,
|
|
346
|
+
});
|
|
347
|
+
setBackupMutationError('');
|
|
348
|
+
setSelectedBackupId(backupId);
|
|
349
|
+
setRestoreBackupOpen(true);
|
|
307
350
|
}, onCreateSchedule: () => {
|
|
308
351
|
if (!isHotBackupEnabled)
|
|
309
352
|
return;
|
|
@@ -465,7 +508,65 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
465
508
|
setBackupMutationBusy(false);
|
|
466
509
|
}
|
|
467
510
|
})();
|
|
468
|
-
}, children: _jsxs(Stack, { gap: 4, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsx("p", { children: safeTranslate(t, 'backups:delete.description', 'Are you sure you want to delete the backup?') })] }) }),
|
|
511
|
+
}, children: _jsxs(Stack, { gap: 4, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsx("p", { children: safeTranslate(t, 'backups:delete.description', 'Are you sure you want to delete the backup?') })] }) }), (() => {
|
|
512
|
+
const selectedBackup = hotBackups.find((b) => b.uuid === selectedBackupId);
|
|
513
|
+
if (!selectedBackup)
|
|
514
|
+
return null;
|
|
515
|
+
const completedAt = toDateOrDash(selectedBackup.completed);
|
|
516
|
+
return (_jsx(C4ClusterDetailsHotBackupsRestore, { open: restoreBackupOpen, backup: {
|
|
517
|
+
id: selectedBackup.uuid,
|
|
518
|
+
name: selectedBackup.name,
|
|
519
|
+
version: selectedBackup.generationName ?? '-',
|
|
520
|
+
completedAt: completedAt === '-' ? '' : completedAt,
|
|
521
|
+
}, currentClusterVersion: cluster?.generation?.name ?? '-', onRequestClose: () => {
|
|
522
|
+
trackEvent('listBackups:restore:cancel', 'Close Restore Backup Modal', { backupId: selectedBackupId });
|
|
523
|
+
setRestoreBackupOpen(false);
|
|
524
|
+
}, onConfirm: (backupId) => {
|
|
525
|
+
if (!isHotBackupEnabled)
|
|
526
|
+
return;
|
|
527
|
+
void (async () => {
|
|
528
|
+
trackEvent('listBackups:restore:confirm', 'Confirm Restore Backup Modal', { backupId });
|
|
529
|
+
setBackupMutationBusy(true);
|
|
530
|
+
setBackupMutationError('');
|
|
531
|
+
try {
|
|
532
|
+
await ConsoleHotBackupsService.restoreHotBackup({
|
|
533
|
+
config: apiConfig,
|
|
534
|
+
params: { orgId, clusterId, backupId },
|
|
535
|
+
});
|
|
536
|
+
setRestoreBackupOpen(false);
|
|
537
|
+
await reloadHotBackups();
|
|
538
|
+
}
|
|
539
|
+
catch (error) {
|
|
540
|
+
setBackupMutationError(error instanceof Error ? error.message : 'Failed');
|
|
541
|
+
captureTelemetryError(error, 'listBackups:restore:confirm', 'Error while restoring backup', { backupId });
|
|
542
|
+
// Global persistent error toast per the spec — admin sees
|
|
543
|
+
// it regardless of which page they navigate to next.
|
|
544
|
+
// Carbon `ToastNotification kind='error'`, timeout=0
|
|
545
|
+
// (disableAutoRemove) so it stays until dismissed.
|
|
546
|
+
addNotification({
|
|
547
|
+
title: safeTranslate(t, 'clusterdetails:hotbackups.restoreErrorTitle', 'Restore failed'),
|
|
548
|
+
subtitle: safeTranslate(t, 'clusterdetails:hotbackups.restoreErrorMessage', 'Restore of "{backupName}" did not complete. Your cluster is unchanged. Contact support if the issue persists.').replace('{backupName}', selectedBackup.name),
|
|
549
|
+
kind: 'error',
|
|
550
|
+
disableAutoRemove: true,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
finally {
|
|
554
|
+
setBackupMutationBusy(false);
|
|
555
|
+
}
|
|
556
|
+
})();
|
|
557
|
+
}, text: {
|
|
558
|
+
title: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.title', 'Restore backup'),
|
|
559
|
+
description: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.description', 'Restoring this backup will replace the current cluster state. This action cannot be undone.'),
|
|
560
|
+
backupLabel: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.backupLabel', 'Backup'),
|
|
561
|
+
dateLabel: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.dateLabel', 'Date'),
|
|
562
|
+
versionLabel: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.versionLabel', 'Version'),
|
|
563
|
+
confirmButton: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.confirmButton', 'Restore'),
|
|
564
|
+
cancelButton: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.cancelButton', 'Cancel'),
|
|
565
|
+
versionMismatchTitle: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.versionMismatchTitle', 'Backup version differs from cluster'),
|
|
566
|
+
versionMismatchBody: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.versionMismatchBody', 'This cluster is on {currentVersion}; the backup was taken on {backupVersion}. Restoring will downgrade the cluster.'),
|
|
567
|
+
acknowledgmentLabel: safeTranslate(t, 'clusterdetails:hotbackups.restoreModal.acknowledgmentLabel', 'I understand this will downgrade the cluster.'),
|
|
568
|
+
} }));
|
|
569
|
+
})(), _jsx(Modal, { open: editScheduleOpen, modalHeading: scheduleIsCreate
|
|
469
570
|
? safeTranslate(t, 'backups:schedule.create.title', 'Create backup schedule')
|
|
470
571
|
: safeTranslate(t, 'backups:schedule.create.updateTitle', 'Edit backup schedule'), primaryButtonText: scheduleIsCreate
|
|
471
572
|
? safeTranslate(t, 'backups:schedule.create.buttons.primary', 'Create schedule')
|
|
@@ -3,6 +3,7 @@ import { ConsoleBackupScheduleService, ConsoleHotBackupsService, } from '@camund
|
|
|
3
3
|
import { cleanup, render, screen, waitFor } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { C4ConsoleNotificationsProvider } from '../../../runtime/c4-console-notifications-context.js';
|
|
6
7
|
import { C4ConsoleRuntimeProvider } from '../../../runtime/c4-console-runtime-context.js';
|
|
7
8
|
import { C4ClusterDetailsHotBackupsTab } from './c4-cluster-details-hot-backups-tab.js';
|
|
8
9
|
let lastHotBackupsProps;
|
|
@@ -80,11 +81,11 @@ describe('C4ClusterDetailsHotBackupsTab', () => {
|
|
|
80
81
|
stage: 'dev',
|
|
81
82
|
auth: { getAccessToken: async () => 'token' },
|
|
82
83
|
backendUrls: {},
|
|
83
|
-
}, children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: true, docsUrls: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
}, children: _jsx(C4ConsoleNotificationsProvider, { children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: true, docsUrls: {
|
|
85
|
+
hotBackups: 'https://docs.example/hot-backups',
|
|
86
|
+
support: 'https://docs.example/support',
|
|
87
|
+
contact: 'https://docs.example/contact',
|
|
88
|
+
}, onNavigate: onNavigate }) }) }));
|
|
88
89
|
await screen.findByRole('button', { name: 'Give feedback' });
|
|
89
90
|
await user.click(screen.getByRole('button', { name: 'Give feedback' }));
|
|
90
91
|
expect(onNavigate).toHaveBeenCalledWith({
|
|
@@ -100,11 +101,11 @@ describe('C4ClusterDetailsHotBackupsTab', () => {
|
|
|
100
101
|
stage: 'dev',
|
|
101
102
|
auth: { getAccessToken: async () => 'token' },
|
|
102
103
|
backendUrls: {},
|
|
103
|
-
}, children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: false, docsUrls: {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
}, children: _jsx(C4ConsoleNotificationsProvider, { children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: false, docsUrls: {
|
|
105
|
+
hotBackups: 'https://docs.example/hot-backups',
|
|
106
|
+
support: 'https://docs.example/support',
|
|
107
|
+
contact: 'https://docs.example/contact',
|
|
108
|
+
} }) }) }));
|
|
108
109
|
// Give effects a tick; we expect no requests.
|
|
109
110
|
await Promise.resolve();
|
|
110
111
|
expect(ConsoleHotBackupsService.getHotBackups).toHaveBeenCalledTimes(0);
|
|
@@ -117,11 +118,11 @@ describe('C4ClusterDetailsHotBackupsTab', () => {
|
|
|
117
118
|
stage: 'dev',
|
|
118
119
|
auth: { getAccessToken: async () => 'token' },
|
|
119
120
|
backendUrls: {},
|
|
120
|
-
}, children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: true, docsUrls: {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
}, children: _jsx(C4ConsoleNotificationsProvider, { children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: true, docsUrls: {
|
|
122
|
+
hotBackups: 'https://docs.example/hot-backups',
|
|
123
|
+
support: 'https://docs.example/support',
|
|
124
|
+
contact: 'https://docs.example/contact',
|
|
125
|
+
} }) }) }));
|
|
125
126
|
await waitFor(() => {
|
|
126
127
|
expect(ConsoleHotBackupsService.getHotBackups).toHaveBeenCalledTimes(1);
|
|
127
128
|
expect(ConsoleBackupScheduleService.getBackupSchedule).toHaveBeenCalledTimes(1);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type RequestBaseParamsConfig } from '@camunda/ccma-api';
|
|
2
2
|
import type { ClusterPlanTypesToReserved, ConsoleClusterDto, HdpPrometheusDataCapacityDataPoint } from '@camunda/ccma-shared-types';
|
|
3
3
|
import { type JSX } from 'react';
|
|
4
|
-
import type { DocsUrls } from '../../../components/c4-job-dashboard-shared/c4-job-dashboard-shared.types';
|
|
5
4
|
import type { C4ClusterDetailsNavigateEvent } from '../c4-cluster-details-app.types';
|
|
6
5
|
type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
|
|
7
6
|
interface ConsoleClusterCreationParametersDto {
|
|
@@ -37,7 +36,6 @@ interface C4ClusterDetailsOverviewTabProps {
|
|
|
37
36
|
orgId: string;
|
|
38
37
|
clusterId: string;
|
|
39
38
|
jobDashboardEnabled: boolean;
|
|
40
|
-
jobDashboardDocsUrls: DocsUrls;
|
|
41
39
|
upgradeDocsUrls: UpgradeDocsUrls;
|
|
42
40
|
statisticsConfig?: {
|
|
43
41
|
jobMetrics: {
|
|
@@ -51,6 +49,7 @@ interface C4ClusterDetailsOverviewTabProps {
|
|
|
51
49
|
onNavigate?: (event: C4ClusterDetailsNavigateEvent) => void;
|
|
52
50
|
ignoreGracePeriod?: boolean;
|
|
53
51
|
clusterLoadDocsUrl: string;
|
|
52
|
+
restoreInProgress?: boolean;
|
|
54
53
|
}
|
|
55
54
|
interface UpgradeDocsUrls {
|
|
56
55
|
whatsNewIn88: string;
|