@camunda/ccma-saas-frontend 0.0.44 → 0.0.46

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 (65) hide show
  1. package/lib/esm/components/c4-app-teaser-cards/c4-app-teaser-cards.d.ts +1 -1
  2. package/lib/esm/components/c4-cluster-client-credentials/c4-cluster-client-credentials.d.ts +3 -3
  3. package/lib/esm/components/c4-cluster-client-credentials-identity/c4-cluster-client-credentials-identity.d.ts +3 -3
  4. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  5. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +13 -1
  6. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +4 -0
  7. package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.d.ts +1 -1
  8. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.d.ts +1 -1
  9. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +5 -2
  10. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +4 -0
  11. package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.d.ts +17 -0
  12. package/lib/esm/components/c4-cluster-settings/elements/optimize-filtering-settings.js +75 -0
  13. package/lib/esm/components/c4-cluster-settings/elements/tasklist-mode-toggle.d.ts +1 -1
  14. package/lib/esm/components/c4-console-dashboard/elements/empty-state.d.ts +1 -1
  15. package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +1 -1
  16. package/lib/esm/components/c4-create-cluster/c4-create-cluster.spec.js +3 -3
  17. package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +8 -0
  18. package/lib/esm/components/c4-divider/c4-divider.d.ts +1 -1
  19. package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.d.ts +1 -1
  20. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.d.ts +1 -1
  21. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-piechart.d.ts +1 -1
  22. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.d.ts +1 -1
  23. package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-time-range-dropdown.d.ts +1 -1
  24. package/lib/esm/components/c4-job-dashboard-shared/c4-timestamp-information.d.ts +1 -1
  25. package/lib/esm/components/c4-multi-step-modal-ugly/c4-multi-step-modal-ugly.d.ts +1 -1
  26. package/lib/esm/components/c4-number-input/c4-number-input.d.ts +1 -1
  27. package/lib/esm/components/c4-page-template/c4-page-template.d.ts +1 -1
  28. package/lib/esm/components/c4-search/c4-search-results.d.ts +1 -1
  29. package/lib/esm/components/c4-telemetry-page/metrics-empty-state-image.d.ts +1 -1
  30. package/lib/esm/i18n/c4-console-i18n.js +4 -0
  31. package/lib/esm/i18n/en/modals/clusters.json +6 -0
  32. package/lib/esm/i18n/en/pages/clusterdetails.json +4 -0
  33. package/lib/esm/i18n/en/pages/clusters.json +5 -1
  34. package/lib/esm/i18n/en/pages/createcluster.json +1 -1
  35. package/lib/esm/icons/c4-icons.d.ts +11 -11
  36. package/lib/esm/runtime/c4-console-authz.d.ts +1 -0
  37. package/lib/esm/runtime/c4-console-authz.js +1 -0
  38. package/lib/esm/runtime/c4-console-data-context.d.ts +1 -1
  39. package/lib/esm/runtime/c4-console-data-context.js +2 -2
  40. package/lib/esm/runtime/c4-console-data-context.types.d.ts +3 -3
  41. package/lib/esm/runtime/c4-console-data-store.d.ts +3 -3
  42. package/lib/esm/runtime/c4-console-data-store.js +34 -15
  43. package/lib/esm/runtime/c4-console-data-store.spec.js +55 -1
  44. package/lib/esm/runtime/c4-console-notifications-context.d.ts +1 -1
  45. package/lib/esm/runtime/c4-console-runtime-context.d.ts +1 -1
  46. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +34 -2
  47. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.spec.js +1 -1
  48. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.d.ts +7 -0
  49. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +5 -2
  50. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.spec.js +49 -1
  51. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +37 -2
  52. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +91 -50
  53. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +226 -3
  54. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +17 -4
  55. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +56 -1
  56. package/lib/esm/widgets/clusters/c4-clusters-page.d.ts +1 -1
  57. package/lib/esm/widgets/clusters/c4-clusters-page.js +207 -17
  58. package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +87 -0
  59. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +2 -0
  60. package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.d.ts +1 -1
  61. package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.d.ts +1 -1
  62. package/lib/esm/widgets/connector-management/c4-connector-management-page.d.ts +1 -1
  63. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +1 -1
  64. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +14 -2
  65. package/package.json +22 -22
@@ -144,8 +144,9 @@ export const ConsoleDataStore = types
144
144
  const map = self.clusterCapacity.get(orgId);
145
145
  return map?.get(clusterId);
146
146
  },
147
- getUpgradableGenerations(fromGenerationUuid) {
148
- const cached = self.upgradableGenerations.get(fromGenerationUuid);
147
+ getUpgradableGenerations(fromGenerationUuid, clusterId) {
148
+ const key = `${fromGenerationUuid}:${clusterId ?? ''}`;
149
+ const cached = self.upgradableGenerations.get(key);
149
150
  return cached?.data;
150
151
  },
151
152
  getGenerationDetails(generationUuid) {
@@ -439,22 +440,23 @@ export const ConsoleDataStore = types
439
440
  self.inFlightClusters.delete(orgId);
440
441
  }
441
442
  }),
442
- fetchUpgradableGenerations: flow(function* (fromGenerationUuid, options) {
443
+ fetchUpgradableGenerations: flow(function* (fromGenerationUuid, clusterId, options) {
443
444
  if (!self.runtime) {
444
445
  throw new Error('Runtime config not set');
445
446
  }
446
447
  if (!fromGenerationUuid) {
447
448
  return;
448
449
  }
449
- const cached = self.upgradableGenerations.get(fromGenerationUuid);
450
+ const cacheKey = `${fromGenerationUuid}:${clusterId ?? ''}`;
451
+ const cached = self.upgradableGenerations.get(cacheKey);
450
452
  if (!options?.force && cached && (cached.isLoading || cached.data)) {
451
453
  return;
452
454
  }
453
- if (self.inFlightUpgradableGenerations.has(fromGenerationUuid)) {
455
+ if (self.inFlightUpgradableGenerations.has(cacheKey)) {
454
456
  return;
455
457
  }
456
- self.inFlightUpgradableGenerations.add(fromGenerationUuid);
457
- self.upgradableGenerations.set(fromGenerationUuid, {
458
+ self.inFlightUpgradableGenerations.add(cacheKey);
459
+ self.upgradableGenerations.set(cacheKey, {
458
460
  data: cached?.data,
459
461
  isLoading: true,
460
462
  error: null,
@@ -462,19 +464,36 @@ export const ConsoleDataStore = types
462
464
  });
463
465
  try {
464
466
  const apiConfig = toApiConfig(self.runtime);
465
- const gens = yield GenerationService.getUpgradable({
466
- fromGenerationUuid,
467
- config: apiConfig,
468
- });
469
- self.upgradableGenerations.set(fromGenerationUuid, {
470
- data: Array.isArray(gens) ? gens : [],
467
+ const flagOn = self.runtime.featureFlags?.isEnabled('console.upgradeVersionSelection') ?? false;
468
+ let dto;
469
+ if (flagOn) {
470
+ dto = yield GenerationService.getUpgradableMulti({
471
+ fromGenerationUuid,
472
+ ...(clusterId ? { clusterId } : {}),
473
+ config: apiConfig,
474
+ });
475
+ }
476
+ else {
477
+ const gens = yield GenerationService.getUpgradable({
478
+ fromGenerationUuid,
479
+ ...(clusterId ? { clusterId } : {}),
480
+ config: apiConfig,
481
+ });
482
+ // Normalize to UpgradableGenerationsDto — preferred is the only item (existing behavior)
483
+ dto = {
484
+ preferred: Array.isArray(gens) && gens.length > 0 ? gens[0] : null,
485
+ options: Array.isArray(gens) ? gens : [],
486
+ };
487
+ }
488
+ self.upgradableGenerations.set(cacheKey, {
489
+ data: dto,
471
490
  isLoading: false,
472
491
  error: null,
473
492
  lastFetched: new Date(),
474
493
  });
475
494
  }
476
495
  catch (error) {
477
- self.upgradableGenerations.set(fromGenerationUuid, {
496
+ self.upgradableGenerations.set(cacheKey, {
478
497
  data: cached?.data,
479
498
  isLoading: false,
480
499
  error: error,
@@ -482,7 +501,7 @@ export const ConsoleDataStore = types
482
501
  });
483
502
  }
484
503
  finally {
485
- self.inFlightUpgradableGenerations.delete(fromGenerationUuid);
504
+ self.inFlightUpgradableGenerations.delete(cacheKey);
486
505
  }
487
506
  }),
488
507
  fetchGenerationDetails: flow(function* (generationUuid, options) {
@@ -4,8 +4,62 @@
4
4
  * You may not use this file except in compliance with the commercial license.
5
5
  */
6
6
  import { SseEntity } from '@camunda/ccma-shared-types';
7
- import { describe, expect, it } from 'vitest';
7
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
8
8
  import { ConsoleDataStore } from './c4-console-data-store.js';
9
+ vi.mock('@camunda/ccma-api', () => ({
10
+ GenerationService: {
11
+ getUpgradable: vi.fn().mockResolvedValue([]),
12
+ getGeneration: vi.fn().mockResolvedValue(undefined),
13
+ upgradeCluster: vi.fn().mockResolvedValue(undefined),
14
+ },
15
+ ClusterService: { updateCluster: vi.fn() },
16
+ OrgsService: { getOrgInfo: vi.fn(), getOwner: vi.fn() },
17
+ EarlyAccessService: { getEarlyAccessFeatures: vi.fn() },
18
+ MembersService: { getMembers: vi.fn() },
19
+ AuditService: { getAudits: vi.fn() },
20
+ }));
21
+ import { GenerationService } from '@camunda/ccma-api';
22
+ const FAKE_RUNTIME = {
23
+ stage: 'dev',
24
+ auth: { getAccessToken: async () => 'token' },
25
+ backendUrls: {
26
+ consoleApiBaseUrl: 'https://console.example.com',
27
+ },
28
+ };
29
+ const makeStore = () => ConsoleDataStore.create({
30
+ clusters: {},
31
+ orgInfo: {},
32
+ orgOwner: {},
33
+ earlyAccessFeatures: {},
34
+ members: {},
35
+ audits: {},
36
+ clusterCapacity: {},
37
+ upgradableGenerations: {},
38
+ generationDetails: {},
39
+ });
40
+ describe('ConsoleDataStore.fetchUpgradableGenerations', () => {
41
+ beforeEach(() => {
42
+ vi.clearAllMocks();
43
+ });
44
+ it('passes clusterId to GenerationService.getUpgradable', async () => {
45
+ const store = makeStore();
46
+ store.setRuntime(FAKE_RUNTIME);
47
+ await store.fetchUpgradableGenerations('gen-uuid', 'cluster-uuid');
48
+ expect(GenerationService.getUpgradable).toHaveBeenCalledWith(expect.objectContaining({
49
+ fromGenerationUuid: 'gen-uuid',
50
+ clusterId: 'cluster-uuid',
51
+ }));
52
+ });
53
+ it('calls GenerationService.getUpgradable without clusterId when not provided', async () => {
54
+ const store = makeStore();
55
+ store.setRuntime(FAKE_RUNTIME);
56
+ await store.fetchUpgradableGenerations('gen-uuid');
57
+ expect(GenerationService.getUpgradable).toHaveBeenCalledWith(expect.objectContaining({
58
+ fromGenerationUuid: 'gen-uuid',
59
+ }));
60
+ expect(GenerationService.getUpgradable).toHaveBeenCalledWith(expect.not.objectContaining({ clusterId: expect.anything() }));
61
+ });
62
+ });
9
63
  describe('ConsoleDataStore.handleClusterChange', () => {
10
64
  it('bumps sse entity versions for all SseEntity values', () => {
11
65
  const store = ConsoleDataStore.create({
@@ -3,5 +3,5 @@ import type { C4ConsoleNotificationsState } from './c4-console-notifications-con
3
3
  export interface C4ConsoleNotificationsProviderProps {
4
4
  children: React.ReactNode;
5
5
  }
6
- export declare const C4ConsoleNotificationsProvider: ({ children, }: C4ConsoleNotificationsProviderProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const C4ConsoleNotificationsProvider: ({ children, }: C4ConsoleNotificationsProviderProps) => React.JSX.Element;
7
7
  export declare const useC4ConsoleNotifications: () => C4ConsoleNotificationsState;
@@ -4,5 +4,5 @@ export interface C4ConsoleRuntimeProviderProps {
4
4
  config: C4ConsoleRuntimeConfig;
5
5
  children: React.ReactNode;
6
6
  }
7
- export declare const C4ConsoleRuntimeProvider: ({ config, children, }: C4ConsoleRuntimeProviderProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const C4ConsoleRuntimeProvider: ({ config, children, }: C4ConsoleRuntimeProviderProps) => React.JSX.Element;
8
8
  export declare const useC4ConsoleRuntime: () => C4ConsoleRuntimeConfig;
@@ -228,6 +228,12 @@ export const C4ClusterDetailsApp = observer((props) => {
228
228
  const [clusterError, setClusterError] = useState('');
229
229
  const [isClusterLoading, setIsClusterLoading] = useState(true);
230
230
  const [creationParameters, setCreationParameters] = useState(undefined);
231
+ // Tracks whether the creationParameters fetch has settled (success OR
232
+ // failure). Needed because `creationParameters === undefined` is
233
+ // ambiguous: it can mean "not yet loaded" or "load failed". Without
234
+ // this distinction, the `privateNetworking` tab fallback below races
235
+ // with the parameters fetch on hard refresh.
236
+ const [isCreationParametersLoading, setIsCreationParametersLoading] = useState(true);
231
237
  const isAwsCluster = useMemo(() => {
232
238
  const regionUuid = cluster?.k8sContext?.uuid;
233
239
  const providerFromCreationParameters = regionUuid
@@ -271,6 +277,7 @@ export const C4ClusterDetailsApp = observer((props) => {
271
277
  config: apiConfig,
272
278
  params: { orgId: props.orgId, clusterId: props.clusterId },
273
279
  });
280
+ skipNextSseMergeRef.current = true;
274
281
  setCluster(loaded);
275
282
  data.upsertCluster(props.orgId, loaded);
276
283
  }
@@ -283,6 +290,7 @@ export const C4ClusterDetailsApp = observer((props) => {
283
290
  }
284
291
  }, [apiConfig, data, props.clusterId, props.orgId]);
285
292
  const reloadCreationParameters = useCallback(async () => {
293
+ setIsCreationParametersLoading(true);
286
294
  try {
287
295
  const loaded = await ConsoleClusterParametersService.getCreationParameters({
288
296
  config: apiConfig,
@@ -293,8 +301,16 @@ export const C4ClusterDetailsApp = observer((props) => {
293
301
  catch {
294
302
  setCreationParameters(undefined);
295
303
  }
304
+ finally {
305
+ setIsCreationParametersLoading(false);
306
+ }
296
307
  }, [apiConfig, props.orgId]);
297
308
  const canSeeClusterLoad = Boolean(authz.visibilities.clusters?.canSeeClusterLoad);
309
+ // After a manual reload, skip the immediately-following SSE merge. A stale
310
+ // SSE event that arrives during the PATCH+reload cycle can overwrite the
311
+ // fresh getCluster() result via mergeNestedSnapshot (e.g. an SSE payload
312
+ // that still carries the old externalMetadata before the PATCH was applied).
313
+ const skipNextSseMergeRef = useRef(false);
298
314
  const clusterLoadLoadedRef = useRef(false);
299
315
  const reloadClusterLoad = useCallback(async () => {
300
316
  if (!canSeeClusterLoad) {
@@ -797,6 +813,10 @@ export const C4ClusterDetailsApp = observer((props) => {
797
813
  if (!found || typeof found !== 'object') {
798
814
  return;
799
815
  }
816
+ if (skipNextSseMergeRef.current) {
817
+ skipNextSseMergeRef.current = false;
818
+ return;
819
+ }
800
820
  setCluster((previous) => {
801
821
  if (!previous) {
802
822
  return found;
@@ -1065,7 +1085,7 @@ export const C4ClusterDetailsApp = observer((props) => {
1065
1085
  hotBackups: urls.docs.hotBackups,
1066
1086
  support: urls.docs.support,
1067
1087
  contact: urls.docs.contact,
1068
- }, t: t, onNavigate: props.onNavigate }));
1088
+ }, t: t, onNavigate: props.onNavigate, onReloadCluster: reloadCluster }));
1069
1089
  const auditLogComponent = useMemo(() => {
1070
1090
  const state = cluster?.externalMetadata?.auditLog;
1071
1091
  const enabled = state?.enabled ?? true;
@@ -1263,12 +1283,24 @@ export const C4ClusterDetailsApp = observer((props) => {
1263
1283
  t,
1264
1284
  ]);
1265
1285
  useEffect(() => {
1286
+ // Only fall back once we have confirmed that the cluster doesn't
1287
+ // support PrivateLink. Both the cluster fetch and the
1288
+ // creation-parameters fetch must settle first — otherwise a hard
1289
+ // refresh on `.../privateNetworking` races the in-flight parameters
1290
+ // load and falsely bounces the user to Overview before
1291
+ // `isAwsCluster` can be determined.
1266
1292
  if (!isClusterLoading &&
1293
+ !isCreationParametersLoading &&
1267
1294
  activeTabId === 'privateNetworking' &&
1268
1295
  !isSecureConnectivityTabVisible) {
1269
1296
  setActiveTabId('overview');
1270
1297
  }
1271
- }, [activeTabId, isClusterLoading, isSecureConnectivityTabVisible]);
1298
+ }, [
1299
+ activeTabId,
1300
+ isClusterLoading,
1301
+ isCreationParametersLoading,
1302
+ isSecureConnectivityTabVisible,
1303
+ ]);
1272
1304
  return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsPage, { loading: isClusterLoading || authz.isLoading, clusterName: cluster?.name, isDevelopmentPlan: cluster?.planType?.development, urls: { clusters: urls.clusters }, onNavigateToClusters: () => props.onNavigate?.({ kind: 'clusters', orgId: props.orgId }), menu: {
1273
1305
  canRename,
1274
1306
  canDelete,
@@ -109,7 +109,7 @@ describe('C4ClusterDetailsClientsTab', () => {
109
109
  vi.mocked(ConsoleClusterClientsService.delete).mockResolvedValue(undefined);
110
110
  renderTab();
111
111
  await userEvent.click(screen.getByRole('button', { name: 'Open delete client' }));
112
- await userEvent.click(screen.getByRole('button', { name: 'dangerDelete' }));
112
+ await userEvent.click(screen.getByRole('button', { name: 'Delete' }));
113
113
  await waitFor(() => {
114
114
  expect(ConsoleClusterClientsService.delete).toHaveBeenCalledWith(expect.objectContaining({
115
115
  params: expect.objectContaining({
@@ -17,6 +17,13 @@ interface C4ClusterDetailsHotBackupsTabProps {
17
17
  };
18
18
  t?: TranslateFn;
19
19
  onNavigate?: (event: C4ClusterDetailsNavigateEvent) => void;
20
+ /**
21
+ * Re-fetches the cluster. The restore-in-progress notification and the
22
+ * edit lockdown key off `cluster.restoreInProgress`, which only changes
23
+ * when the cluster itself is reloaded — so the tab must trigger this after
24
+ * confirming a restore for the UI to update without a page refresh.
25
+ */
26
+ onReloadCluster?: () => void | Promise<void>;
20
27
  }
21
28
  export declare const C4ClusterDetailsHotBackupsTab: (props: C4ClusterDetailsHotBackupsTabProps) => JSX.Element;
22
29
  export {};
@@ -95,7 +95,7 @@ function safeTranslate(t, key, fallback) {
95
95
  return result === key ? fallback : result;
96
96
  }
97
97
  export const C4ClusterDetailsHotBackupsTab = (props) => {
98
- const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, docsUrls, t, onNavigate, } = props;
98
+ const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, docsUrls, t, onNavigate, onReloadCluster, } = props;
99
99
  const data = useC4ConsoleData();
100
100
  const runtime = useC4ConsoleRuntime();
101
101
  const { add: addNotification } = useC4ConsoleNotifications();
@@ -534,7 +534,10 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
534
534
  params: { orgId, clusterId, backupId },
535
535
  });
536
536
  setRestoreBackupOpen(false);
537
- await reloadHotBackups();
537
+ // Reload the backup list AND the cluster: the latter flips
538
+ // `restoreInProgress`, which drives the restore notification
539
+ // and the edit lockdown instantly, without a page refresh.
540
+ await Promise.all([reloadHotBackups(), onReloadCluster?.()]);
538
541
  }
539
542
  catch (error) {
540
543
  setBackupMutationError(error instanceof Error ? error.message : 'Failed');
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ConsoleBackupScheduleService, ConsoleHotBackupsService, } from '@camunda/ccma-api';
3
+ import { BackupStatus } from '@camunda/ccma-shared-types';
3
4
  import { cleanup, render, screen, waitFor } from '@testing-library/react';
4
5
  import userEvent from '@testing-library/user-event';
5
6
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -23,6 +24,7 @@ vi.mock('@camunda/ccma-api', async () => {
23
24
  getHotBackups: vi.fn(),
24
25
  createHotBackup: vi.fn(),
25
26
  deleteHotBackup: vi.fn(),
27
+ restoreHotBackup: vi.fn(),
26
28
  },
27
29
  ConsoleBackupScheduleService: {
28
30
  getBackupSchedule: vi.fn(),
@@ -41,10 +43,17 @@ vi.mock('../../../components/c4-cluster-details-hot-backups/c4-cluster-details-h
41
43
  return {
42
44
  C4ClusterDetailsHotBackups: (props) => {
43
45
  lastHotBackupsProps = props;
44
- return (_jsxs("div", { children: [_jsx("div", { children: "Hot backups" }), _jsx("button", { type: 'button', onClick: props.onGiveFeedback, children: props.text.giveFeedback })] }));
46
+ return (_jsxs("div", { children: [_jsx("div", { children: "Hot backups" }), _jsx("button", { type: 'button', onClick: props.onGiveFeedback, children: props.text.giveFeedback }), props.backups.map((backup) => (_jsx("button", { type: 'button', onClick: () => props.onRestoreBackup?.(backup.uuid), children: `restore-${backup.uuid}` }, backup.uuid)))] }));
45
47
  },
46
48
  };
47
49
  });
50
+ // Stub the restore modal so the test can drive its confirm callback directly,
51
+ // without rendering the real Carbon modal.
52
+ vi.mock('../../../components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore', () => {
53
+ return {
54
+ C4ClusterDetailsHotBackupsRestore: (props) => props.open ? (_jsx("button", { type: 'button', onClick: () => props.onConfirm(props.backup.id), children: "confirm-restore" })) : null,
55
+ };
56
+ });
48
57
  function buildCluster() {
49
58
  return {
50
59
  uuid: 'cluster-1',
@@ -128,4 +137,43 @@ describe('C4ClusterDetailsHotBackupsTab', () => {
128
137
  expect(ConsoleBackupScheduleService.getBackupSchedule).toHaveBeenCalledTimes(1);
129
138
  });
130
139
  });
140
+ it('reloads the cluster after confirming a restore so the lockdown applies instantly', async () => {
141
+ const user = userEvent.setup();
142
+ const onReloadCluster = vi.fn().mockResolvedValue(undefined);
143
+ vi.mocked(ConsoleHotBackupsService.getHotBackups).mockResolvedValue([
144
+ {
145
+ uuid: 'backup-1',
146
+ name: 'Backup 1',
147
+ status: BackupStatus.COMPLETE,
148
+ generationUuid: 'gen-1',
149
+ generationName: 'Gen',
150
+ created: '2025-01-01T00:00:00Z',
151
+ completed: '2025-01-01T01:00:00Z',
152
+ },
153
+ ]);
154
+ vi.mocked(ConsoleBackupScheduleService.getBackupSchedule).mockResolvedValue([]);
155
+ vi.mocked(ConsoleHotBackupsService.restoreHotBackup).mockResolvedValue(undefined);
156
+ render(_jsx(C4ConsoleRuntimeProvider, { config: {
157
+ stage: 'dev',
158
+ auth: { getAccessToken: async () => 'token' },
159
+ backendUrls: {},
160
+ }, children: _jsx(C4ConsoleNotificationsProvider, { children: _jsx(C4ClusterDetailsHotBackupsTab, { cluster: buildCluster(), orgId: 'org-1', clusterId: 'cluster-1', apiConfig: apiConfig, canMutateCluster: true, isHotBackupEnabled: true, docsUrls: {
161
+ hotBackups: 'https://docs.example/hot-backups',
162
+ support: 'https://docs.example/support',
163
+ contact: 'https://docs.example/contact',
164
+ }, onReloadCluster: onReloadCluster }) }) }));
165
+ // Open the restore modal for the backup, then confirm.
166
+ await user.click(await screen.findByText('restore-backup-1'));
167
+ await user.click(await screen.findByText('confirm-restore'));
168
+ await waitFor(() => {
169
+ expect(ConsoleHotBackupsService.restoreHotBackup).toHaveBeenCalledWith(expect.objectContaining({
170
+ params: {
171
+ orgId: 'org-1',
172
+ clusterId: 'cluster-1',
173
+ backupId: 'backup-1',
174
+ },
175
+ }));
176
+ expect(onReloadCluster).toHaveBeenCalledTimes(1);
177
+ });
178
+ });
131
179
  });
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ConsoleIpWhitelistService } from '@camunda/ccma-api';
2
+ import { ConsoleIpWhitelistService, ConsoleSecureConnectivityService, } from '@camunda/ccma-api';
3
3
  import { Form, InlineNotification, Modal, Stack, TextInput, } from '@carbon/react';
4
4
  import { useCallback, useEffect, useState } from 'react';
5
5
  import { C4ClusterDetailsIpWhitelist } from '../../../components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js';
@@ -80,6 +80,7 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
80
80
  const { cluster, isClusterLoading, orgId, clusterId, docsUrl, apiConfig, canMutateCluster, t, onNavigate, onReloadCluster, } = props;
81
81
  const runtime = useC4ConsoleRuntime();
82
82
  const [ipWhitelistItems, setIpWhitelistItems] = useState([]);
83
+ const [hasPrivateLink, setHasPrivateLink] = useState(false);
83
84
  const [createIpOpen, setCreateIpOpen] = useState(false);
84
85
  const [updateIpOpen, setUpdateIpOpen] = useState(false);
85
86
  const [deleteIpOpen, setDeleteIpOpen] = useState(false);
@@ -96,6 +97,36 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
96
97
  description: entry.description,
97
98
  })));
98
99
  }, [cluster?.ipWhitelist]);
100
+ // Detect whether PrivateLink is active for this cluster so we can warn
101
+ // users when an IP allowlist is also configured: PrivateLink connections
102
+ // arrive with private VPC IPs (not the customer's public IPs), so the
103
+ // allowlist will silently block PrivateLink traffic unless the VPC CIDR
104
+ // is included.
105
+ useEffect(() => {
106
+ let cancelled = false;
107
+ void (async () => {
108
+ try {
109
+ const status = await ConsoleSecureConnectivityService.getStatus({
110
+ config: apiConfig,
111
+ params: { orgId, clusterId },
112
+ });
113
+ if (!cancelled) {
114
+ setHasPrivateLink(!!status);
115
+ }
116
+ }
117
+ catch {
118
+ if (!cancelled) {
119
+ setHasPrivateLink(false);
120
+ }
121
+ }
122
+ })();
123
+ return () => {
124
+ cancelled = true;
125
+ };
126
+ }, [apiConfig, clusterId, orgId]);
127
+ const showPrivateLinkConflictWarning = hasPrivateLink && ipWhitelistItems.length > 0;
128
+ const privateLinkConflictTitle = safeTranslate(t, 'clusterdetails:secureConnectivity.ipAllowlistConflict.title', 'IP allowlist may block PrivateLink traffic');
129
+ const privateLinkConflictSubtitle = safeTranslate(t, 'clusterdetails:secureConnectivity.ipAllowlistConflict.subtitle', 'The IP allowlist also applies to PrivateLink traffic. PrivateLink connections arrive with private VPC IPs (not your public or corporate IPs), so they will be blocked unless the allowlist includes your VPC CIDR. Add your VPC CIDR to the allowlist, or remove the allowlist entirely.');
99
130
  const persistIpWhitelist = useCallback(async (next) => {
100
131
  await ConsoleIpWhitelistService.update({
101
132
  config: apiConfig,
@@ -121,7 +152,11 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
121
152
  ...meta,
122
153
  });
123
154
  }, [clusterId, orgId, runtime.telemetry]);
124
- return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsIpWhitelist, { ipWhitelist: ipWhitelistItems, isLoading: isClusterLoading, text: {
155
+ return (_jsxs(_Fragment, { children: [showPrivateLinkConflictWarning && (_jsx(InlineNotification, { kind: 'warning', lowContrast: true, hideCloseButton: true, title: privateLinkConflictTitle, subtitle: privateLinkConflictSubtitle, style: {
156
+ maxWidth: '100%',
157
+ width: '100%',
158
+ marginBottom: 'var(--cds-spacing-05)',
159
+ } })), _jsx(C4ClusterDetailsIpWhitelist, { ipWhitelist: ipWhitelistItems, isLoading: isClusterLoading, text: {
125
160
  title: safeTranslate(t, 'clusterdetails:ipWhitelist.title', 'IP Allowlist'),
126
161
  createButton: safeTranslate(t, 'clusterdetails:ipWhitelist.createButton', 'Create new entry'),
127
162
  searchLabel: 'Search',