@camunda/ccma-saas-frontend 0.3.1 → 0.4.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.
- package/lib/esm/components/c4-activity-graph/c4-activity-graph.d.ts +2 -2
- package/lib/esm/components/c4-activity-graph/c4-activity-graph.js +90 -73
- package/lib/esm/components/c4-advanced-search-filters/c4-advanced-search-filters.js +13 -13
- package/lib/esm/components/c4-billing-page/elements/current-usage-metrics.js +7 -1
- package/lib/esm/components/c4-charts-dashboard/c4-charts-dashboard.d.ts +1 -1
- package/lib/esm/components/c4-charts-dashboard/c4-charts-dashboard.js +31 -25
- package/lib/esm/components/c4-cluster-details-activity/c4-cluster-details-activity.js +11 -8
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.d.ts +1 -1
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +21 -20
- package/lib/esm/components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js +10 -2
- package/lib/esm/components/c4-cluster-overview/applications.js +7 -1
- package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +7 -1
- package/lib/esm/components/c4-data-table/c4-data-table.js +58 -4
- package/lib/esm/components/c4-data-table/c4-data-table.spec.js +52 -1
- package/lib/esm/components/c4-management-activity/c4-management-activity.d.ts +1 -1
- package/lib/esm/components/c4-management-activity/c4-management-activity.js +9 -4
- package/lib/esm/components/c4-management-settings/c4-management-settings.d.ts +1 -1
- package/lib/esm/components/c4-management-settings/c4-management-settings.js +9 -5
- package/lib/esm/components/c4-stackdriver-links/c4-stackdriver-links.js +3 -4
- package/lib/esm/components/c4-usage-history/c4-usage-history.d.ts +1 -1
- package/lib/esm/components/c4-usage-history/c4-usage-history.js +5 -2
- package/lib/esm/components/c4-usage-history/elements/usage-history-charts.d.ts +2 -2
- package/lib/esm/components/c4-usage-history/elements/usage-history-charts.js +6 -2
- package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.d.ts +1 -1
- package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.js +14 -8
- package/lib/esm/runtime/c4-console-data-context.d.ts +17 -5
- package/lib/esm/runtime/c4-console-data-context.js +40 -15
- package/lib/esm/runtime/c4-console-data-context.spec.d.ts +1 -0
- package/lib/esm/runtime/c4-console-data-context.spec.js +354 -0
- package/lib/esm/runtime/c4-console-data-context.types.d.ts +6 -0
- package/lib/esm/runtime/c4-console-data-store.d.ts +11 -0
- package/lib/esm/runtime/c4-console-data-store.js +74 -34
- package/lib/esm/runtime/c4-console-data-store.nav.spec.js +1 -0
- package/lib/esm/runtime/c4-console-data-store.spec.js +147 -1
- package/lib/esm/runtime/c4-user-notifications-context.spec.js +2 -0
- package/lib/esm/runtime/nav/use-webapp-nav-data.js +11 -3
- package/lib/esm/runtime/to-api-config.d.ts +1 -1
- package/lib/esm/runtime/to-api-config.js +6 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +3 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +6 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.d.ts +3 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +5 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +3 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +5 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.d.ts +3 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +5 -1
- package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +12 -3
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +24 -6
- package/package.json +7 -4
|
@@ -19,8 +19,11 @@ vi.mock('@camunda/ccma-api', () => ({
|
|
|
19
19
|
EarlyAccessService: { getEarlyAccessFeatures: vi.fn() },
|
|
20
20
|
MembersService: { getMembers: vi.fn() },
|
|
21
21
|
AuditService: { getAudits: vi.fn() },
|
|
22
|
+
HdpService: { getClusterCapacity: vi.fn() },
|
|
23
|
+
ConsoleApiClientsService: { getAll: vi.fn().mockResolvedValue([]) },
|
|
24
|
+
correlationHeaders: () => ({}),
|
|
22
25
|
}));
|
|
23
|
-
import { GenerationService } from '@camunda/ccma-api';
|
|
26
|
+
import { ConsoleApiClientsService, GenerationService, HdpService, } from '@camunda/ccma-api';
|
|
24
27
|
const FAKE_RUNTIME = {
|
|
25
28
|
stage: 'dev',
|
|
26
29
|
auth: { getAccessToken: async () => 'token' },
|
|
@@ -62,6 +65,48 @@ describe('ConsoleDataStore.fetchUpgradableGenerations', () => {
|
|
|
62
65
|
expect(GenerationService.getUpgradableMulti).toHaveBeenCalledWith(expect.not.objectContaining({ clusterId: expect.anything() }));
|
|
63
66
|
});
|
|
64
67
|
});
|
|
68
|
+
describe('ConsoleDataStore.fetchClients', () => {
|
|
69
|
+
beforeEach(() => {
|
|
70
|
+
vi.clearAllMocks();
|
|
71
|
+
});
|
|
72
|
+
it('populates the clients cache from ConsoleApiClientsService.getAll', async () => {
|
|
73
|
+
const store = makeStore();
|
|
74
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
75
|
+
const clientsList = [
|
|
76
|
+
{ uuid: 'client-1', clientId: 'id-1', name: 'Client 1' },
|
|
77
|
+
];
|
|
78
|
+
vi.mocked(ConsoleApiClientsService.getAll).mockResolvedValueOnce(clientsList);
|
|
79
|
+
await store.fetchClients('org-1');
|
|
80
|
+
expect(ConsoleApiClientsService.getAll).toHaveBeenCalledWith(expect.objectContaining({ params: { orgId: 'org-1' } }));
|
|
81
|
+
expect(store.getClients('org-1')).toEqual(clientsList);
|
|
82
|
+
});
|
|
83
|
+
it('updates an already-populated clients cache when forced', async () => {
|
|
84
|
+
const store = ConsoleDataStore.create({
|
|
85
|
+
clusters: {},
|
|
86
|
+
orgInfo: {},
|
|
87
|
+
orgOwner: {},
|
|
88
|
+
earlyAccessFeatures: {},
|
|
89
|
+
members: {},
|
|
90
|
+
audits: {},
|
|
91
|
+
clients: {
|
|
92
|
+
'org-1': {
|
|
93
|
+
data: [{ uuid: 'old-client' }],
|
|
94
|
+
isLoading: false,
|
|
95
|
+
error: null,
|
|
96
|
+
lastFetched: null,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
clusterCapacity: {},
|
|
100
|
+
upgradableGenerations: {},
|
|
101
|
+
generationDetails: {},
|
|
102
|
+
});
|
|
103
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
104
|
+
const nextClients = [{ uuid: 'new-client' }];
|
|
105
|
+
vi.mocked(ConsoleApiClientsService.getAll).mockResolvedValueOnce(nextClients);
|
|
106
|
+
await store.fetchClients('org-1', { force: true });
|
|
107
|
+
expect(store.getClients('org-1')).toEqual(nextClients);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
65
110
|
describe('ConsoleDataStore.handleClusterChange', () => {
|
|
66
111
|
it('bumps sse entity versions for all SseEntity values', () => {
|
|
67
112
|
const store = ConsoleDataStore.create({
|
|
@@ -260,4 +305,105 @@ describe('ConsoleDataStore.handleClusterChange', () => {
|
|
|
260
305
|
const cluster = store.getClusters('org-1')?.[0];
|
|
261
306
|
expect(cluster?.externalMetadata?.optimizeFiltering).toBeUndefined();
|
|
262
307
|
});
|
|
308
|
+
it('triggers a forced fetchClients refetch when the clients cache is present', async () => {
|
|
309
|
+
vi.clearAllMocks();
|
|
310
|
+
const store = ConsoleDataStore.create({
|
|
311
|
+
clusters: {},
|
|
312
|
+
orgInfo: {},
|
|
313
|
+
orgOwner: {},
|
|
314
|
+
earlyAccessFeatures: {},
|
|
315
|
+
members: {},
|
|
316
|
+
audits: {},
|
|
317
|
+
clients: {
|
|
318
|
+
'org-1': {
|
|
319
|
+
// Cache already has data and is not loading, so a *non-forced*
|
|
320
|
+
// fetchClients call would short-circuit and skip the API call
|
|
321
|
+
// (see the early-return in fetchClients). Observing a call to
|
|
322
|
+
// ConsoleApiClientsService.getAll here proves handleClusterChange
|
|
323
|
+
// passed `{ force: true }`.
|
|
324
|
+
data: [{ uuid: 'existing-client' }],
|
|
325
|
+
isLoading: false,
|
|
326
|
+
error: null,
|
|
327
|
+
lastFetched: new Date(),
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
clusterCapacity: {},
|
|
331
|
+
upgradableGenerations: {},
|
|
332
|
+
generationDetails: {},
|
|
333
|
+
});
|
|
334
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
335
|
+
const refreshedClients = [{ uuid: 'refreshed-client' }];
|
|
336
|
+
vi.mocked(ConsoleApiClientsService.getAll).mockResolvedValueOnce(refreshedClients);
|
|
337
|
+
store.handleClusterChange({
|
|
338
|
+
org: 'org-1',
|
|
339
|
+
entity: SseEntity.CONSOLE_API_CLIENT,
|
|
340
|
+
clusterId: 'client-1',
|
|
341
|
+
type: 'created',
|
|
342
|
+
});
|
|
343
|
+
await vi.waitFor(() => {
|
|
344
|
+
expect(ConsoleApiClientsService.getAll).toHaveBeenCalledWith(expect.objectContaining({ params: { orgId: 'org-1' } }));
|
|
345
|
+
});
|
|
346
|
+
await vi.waitFor(() => {
|
|
347
|
+
expect(store.getClients('org-1')).toEqual(refreshedClients);
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
it('does not trigger fetchClients when the clients cache has not been populated', () => {
|
|
351
|
+
vi.clearAllMocks();
|
|
352
|
+
const store = makeStore();
|
|
353
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
354
|
+
store.handleClusterChange({
|
|
355
|
+
org: 'org-1',
|
|
356
|
+
entity: SseEntity.CONSOLE_API_CLIENT,
|
|
357
|
+
clusterId: 'client-1',
|
|
358
|
+
type: 'created',
|
|
359
|
+
});
|
|
360
|
+
expect(ConsoleApiClientsService.getAll).not.toHaveBeenCalled();
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
describe('ConsoleDataStore.fetchClusterCapacity', () => {
|
|
364
|
+
beforeEach(() => {
|
|
365
|
+
vi.clearAllMocks();
|
|
366
|
+
});
|
|
367
|
+
it('fetches capacity for all clusters in a single batched request', async () => {
|
|
368
|
+
const store = makeStore();
|
|
369
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
370
|
+
vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([
|
|
371
|
+
{ clusterId: 'c1', ts: 0, avg: 0.1, min: 0.1, max: 0.1 },
|
|
372
|
+
{ clusterId: 'c2', ts: 0, avg: 0.2, min: 0.2, max: 0.2 },
|
|
373
|
+
{ clusterId: 'c3', ts: 0, avg: 0.3, min: 0.3, max: 0.3 },
|
|
374
|
+
]);
|
|
375
|
+
await store.fetchClusterCapacity('org-1', ['c1', 'c2', 'c3']);
|
|
376
|
+
// Exactly one HTTP call for N clusters (previously N serial calls).
|
|
377
|
+
expect(HdpService.getClusterCapacity).toHaveBeenCalledTimes(1);
|
|
378
|
+
expect(HdpService.getClusterCapacity).toHaveBeenCalledWith(expect.objectContaining({
|
|
379
|
+
params: expect.objectContaining({
|
|
380
|
+
orgId: 'org-1',
|
|
381
|
+
clusterIds: ['c1', 'c2', 'c3'],
|
|
382
|
+
operation: 'latest',
|
|
383
|
+
}),
|
|
384
|
+
}));
|
|
385
|
+
expect(store.getClusterCapacity('org-1', 'c1')).toBe(0.1);
|
|
386
|
+
expect(store.getClusterCapacity('org-1', 'c2')).toBe(0.2);
|
|
387
|
+
expect(store.getClusterCapacity('org-1', 'c3')).toBe(0.3);
|
|
388
|
+
});
|
|
389
|
+
it('maps only clusters present in the response (partial data)', async () => {
|
|
390
|
+
const store = makeStore();
|
|
391
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
392
|
+
vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([
|
|
393
|
+
{ clusterId: 'c1', ts: 0, avg: 0.5, min: 0.5, max: 0.5 },
|
|
394
|
+
]);
|
|
395
|
+
await store.fetchClusterCapacity('org-1', ['c1', 'c2']);
|
|
396
|
+
expect(store.getClusterCapacity('org-1', 'c1')).toBe(0.5);
|
|
397
|
+
expect(store.getClusterCapacity('org-1', 'c2')).toBeUndefined();
|
|
398
|
+
});
|
|
399
|
+
it('caches an empty result on request failure without throwing', async () => {
|
|
400
|
+
const store = makeStore();
|
|
401
|
+
store.setRuntime(FAKE_RUNTIME);
|
|
402
|
+
vi.mocked(HdpService.getClusterCapacity).mockRejectedValue(new Error('boom'));
|
|
403
|
+
await expect(store.fetchClusterCapacity('org-1', ['c1'])).resolves.toBeUndefined();
|
|
404
|
+
expect(store.getClusterCapacity('org-1', 'c1')).toBeUndefined();
|
|
405
|
+
// A second call is a cache hit (no retry storm).
|
|
406
|
+
await store.fetchClusterCapacity('org-1', ['c1']);
|
|
407
|
+
expect(HdpService.getClusterCapacity).toHaveBeenCalledTimes(1);
|
|
408
|
+
});
|
|
263
409
|
});
|
|
@@ -10,6 +10,8 @@ vi.mock('@camunda/ccma-api', () => ({
|
|
|
10
10
|
trackEvent: vi.fn().mockResolvedValue(undefined),
|
|
11
11
|
streamUserNotifications: vi.fn(() => ({ close: vi.fn(), state: 'closed' })),
|
|
12
12
|
},
|
|
13
|
+
// Imported by to-api-config (used by the provider) — must be present on the mock.
|
|
14
|
+
correlationHeaders: vi.fn(() => ({})),
|
|
13
15
|
}));
|
|
14
16
|
import { ExternalNotificationsService } from '@camunda/ccma-api';
|
|
15
17
|
import { C4ConsoleRuntimeProvider } from './c4-console-runtime-context.js';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
4
|
* You may not use this file except in compliance with the commercial license.
|
|
5
5
|
*/
|
|
6
|
+
import { useObserver } from 'mobx-react-lite';
|
|
6
7
|
import { useEffect, useMemo } from 'react';
|
|
7
8
|
import { useC4ConsoleData } from '../c4-console-data-context.js';
|
|
8
9
|
import { useC4ConsoleRuntime } from '../c4-console-runtime-context.js';
|
|
@@ -30,7 +31,10 @@ export function useC4ClusterNavEntries(orgId, options = {}) {
|
|
|
30
31
|
void data.fetchWebappClusters(orgId);
|
|
31
32
|
}
|
|
32
33
|
}, [data, orgId]);
|
|
33
|
-
|
|
34
|
+
// Read through useObserver so this hook re-renders its caller when the
|
|
35
|
+
// webapp-cluster data changes, even when that caller is not itself an
|
|
36
|
+
// observer (the data context value is stable and no longer bumps globally).
|
|
37
|
+
const clusters = useObserver(() => data.getWebappClusters(orgId));
|
|
34
38
|
const { apps = DEFAULT_NAV_APPS, isAppVisible, appTeaserHrefs, appLabels, } = options;
|
|
35
39
|
return useMemo(() => {
|
|
36
40
|
if (!clusters) {
|
|
@@ -99,8 +103,12 @@ export function useC4WebappBreadcrumbData(options) {
|
|
|
99
103
|
void data.fetchWebappClusters(orgId);
|
|
100
104
|
}
|
|
101
105
|
}, [data, orgId]);
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
// Read through useObserver so this hook re-renders its caller when the orgs
|
|
107
|
+
// or webapp-cluster data changes, even for non-observer callers.
|
|
108
|
+
const { orgs, clusters } = useObserver(() => ({
|
|
109
|
+
orgs: data.getMyOrgs(),
|
|
110
|
+
clusters: data.getWebappClusters(orgId),
|
|
111
|
+
}));
|
|
104
112
|
return useMemo(() => {
|
|
105
113
|
const crumbs = [];
|
|
106
114
|
const modelerUrl = webappLinks?.modeler ?? runtime.publicUrls?.modelerBaseUrl;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RequestBaseParamsConfig } from '@camunda/ccma-api';
|
|
2
2
|
import type { C4ConsoleRuntimeConfig } from './c4-console-runtime.types';
|
|
3
3
|
export declare function toApiConfig(runtime: C4ConsoleRuntimeConfig): RequestBaseParamsConfig;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
4
|
* You may not use this file except in compliance with the commercial license.
|
|
5
5
|
*/
|
|
6
|
+
import { correlationHeaders, } from '@camunda/ccma-api';
|
|
6
7
|
function normalizeBaseUrl(url) {
|
|
7
8
|
return url.endsWith('/') ? url.slice(0, -1) : url;
|
|
8
9
|
}
|
|
@@ -30,6 +31,11 @@ export function toApiConfig(runtime) {
|
|
|
30
31
|
auth: {
|
|
31
32
|
getToken: runtime.auth.getAccessToken,
|
|
32
33
|
},
|
|
34
|
+
// Start a W3C trace per request and send the stable per-tab session id, so
|
|
35
|
+
// every c4 runtime request (and its SSE streams) is followable end to end
|
|
36
|
+
// and grouped into the browser session — matching the console/accounts
|
|
37
|
+
// frontends. No-op-safe on any host that embeds c4.
|
|
38
|
+
getDynamicHeaders: correlationHeaders,
|
|
33
39
|
envOverride: Object.keys(envOverride).length > 0 ? envOverride : undefined,
|
|
34
40
|
};
|
|
35
41
|
}
|
|
@@ -20,5 +20,7 @@ interface C4ClusterDetailsConnectorSecretsTabProps {
|
|
|
20
20
|
}) => void;
|
|
21
21
|
useClusterSecretsLabel?: boolean;
|
|
22
22
|
}
|
|
23
|
-
export declare const C4ClusterDetailsConnectorSecretsTab: (props: C4ClusterDetailsConnectorSecretsTabProps) => JSX.Element
|
|
23
|
+
export declare const C4ClusterDetailsConnectorSecretsTab: ((props: C4ClusterDetailsConnectorSecretsTabProps) => JSX.Element) & {
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
24
26
|
export {};
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { ConsoleConnectorSecretsService } from '@camunda/ccma-api';
|
|
3
3
|
import { SECRETS_MAX_LENGTH, SseEntity } from '@camunda/ccma-shared-types';
|
|
4
4
|
import { FileUploader, Form, InlineLoading, PasswordInput } from '@carbon/react';
|
|
5
|
+
import { observer } from 'mobx-react-lite';
|
|
5
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
7
|
import { C4ClusterDetailsConnectorSecrets } from '../../../components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js';
|
|
7
8
|
import { C4InlineNotification } from '../../../components/c4-inline-notification/c4-inline-notification.js';
|
|
@@ -40,7 +41,7 @@ function renderInlineLink0(value, linkRenderer) {
|
|
|
40
41
|
const [, before, label, after] = match;
|
|
41
42
|
return (_jsxs("span", { children: [before, linkRenderer(label), after] }));
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
44
45
|
const { Select, SelectItem } = useSelectFamily();
|
|
45
46
|
const { orgId, clusterId, apiConfig, canMutateCluster, connectorSecretsPermissions, docsUrl, t, onNavigate, useClusterSecretsLabel, } = props;
|
|
46
47
|
const pickSecretsText = (connectorKey, connectorFallback, clusterKey, clusterFallback) => useClusterSecretsLabel
|
|
@@ -603,3 +604,7 @@ export const C4ClusterDetailsConnectorSecretsTab = (props) => {
|
|
|
603
604
|
!fetchingSourceSecrets &&
|
|
604
605
|
Object.keys(sourceClusterSecrets).length === 0 && (_jsx("p", { children: safeTranslate(t, 'connectorsecrets:importFromCluster.noSecretsInCluster', 'No secrets found in selected cluster') }))] }))] }) })] }));
|
|
605
606
|
};
|
|
607
|
+
// Reads console data during render, so it must be an observer to re-render when
|
|
608
|
+
// that data changes (the data context value is stable and no longer bumps
|
|
609
|
+
// globally on every store mutation).
|
|
610
|
+
export const C4ClusterDetailsConnectorSecretsTab = observer(C4ClusterDetailsConnectorSecretsTabImpl);
|
|
@@ -25,5 +25,7 @@ interface C4ClusterDetailsHotBackupsTabProps {
|
|
|
25
25
|
*/
|
|
26
26
|
onReloadCluster?: () => void | Promise<void>;
|
|
27
27
|
}
|
|
28
|
-
export declare const C4ClusterDetailsHotBackupsTab: (props: C4ClusterDetailsHotBackupsTabProps) => JSX.Element
|
|
28
|
+
export declare const C4ClusterDetailsHotBackupsTab: ((props: C4ClusterDetailsHotBackupsTabProps) => JSX.Element) & {
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
29
31
|
export {};
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { ConsoleBackupScheduleService, ConsoleHotBackupsService, } from '@camunda/ccma-api';
|
|
3
3
|
import { BackupStatus, checkVersion, HOTBACKUP_MIN_CREATE_PERIOD, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
4
4
|
import { CronExpression, CronExpressionParser, CronFieldCollection, } from 'cron-parser';
|
|
5
|
+
import { observer } from 'mobx-react-lite';
|
|
5
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
7
|
import { C4ClusterDetailsHotBackups } from '../../../components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js';
|
|
7
8
|
import { C4ClusterDetailsHotBackupsRestore } from '../../../components/c4-cluster-details-hot-backups-restore/c4-cluster-details-hot-backups-restore.js';
|
|
@@ -95,7 +96,7 @@ function safeTranslate(t, key, fallback) {
|
|
|
95
96
|
const result = t(key);
|
|
96
97
|
return result === key ? fallback : result;
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
+
const C4ClusterDetailsHotBackupsTabImpl = (props) => {
|
|
99
100
|
const { Select, SelectItem } = useSelectFamily();
|
|
100
101
|
const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, docsUrls, t, onNavigate, onReloadCluster, } = props;
|
|
101
102
|
const data = useC4ConsoleData();
|
|
@@ -705,3 +706,6 @@ export const C4ClusterDetailsHotBackupsTab = (props) => {
|
|
|
705
706
|
})();
|
|
706
707
|
}, children: _jsxs(Stack, { gap: 4, children: [backupMutationError && _jsx("p", { children: backupMutationError }), _jsx("p", { children: safeTranslate(t, 'backups:schedule.delete.description', 'Are you sure you want to remove the backup schedule?') })] }) })] }));
|
|
707
708
|
};
|
|
709
|
+
// Reads console data (SSE entity version) during render, so it must be an
|
|
710
|
+
// observer to re-render when that data changes.
|
|
711
|
+
export const C4ClusterDetailsHotBackupsTab = observer(C4ClusterDetailsHotBackupsTabImpl);
|
|
@@ -56,5 +56,7 @@ interface UpgradeDocsUrls {
|
|
|
56
56
|
tasklistApiVersions: string;
|
|
57
57
|
announcementsApiTools: string;
|
|
58
58
|
}
|
|
59
|
-
export declare const C4ClusterDetailsOverviewTab: (props: C4ClusterDetailsOverviewTabProps) => JSX.Element | null
|
|
59
|
+
export declare const C4ClusterDetailsOverviewTab: ((props: C4ClusterDetailsOverviewTabProps) => JSX.Element | null) & {
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
60
62
|
export {};
|
|
@@ -8,6 +8,7 @@ import { C3ClusterTag, useC3Profile, } from '@camunda/camunda-composite-componen
|
|
|
8
8
|
import { SaaSJobsService, } from '@camunda/ccma-api';
|
|
9
9
|
import { ClusterPlanTypeAvailabilityClass, ClusterPlanTypeCategory, checkVersion, MAX_HARDWARE_PACKAGE_COUNT, sortGenerationBySemverOfZeebe, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
10
10
|
import { Api_1, ApiKey, CheckmarkFilled, Renew, Security, UserAccessLocked, } from '@carbon/react/icons/index.esm.js';
|
|
11
|
+
import { observer } from 'mobx-react-lite';
|
|
11
12
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
12
13
|
import { normalizeClusterStatus } from '../../../components/c4-cluster-overview/applications.js';
|
|
13
14
|
import { C4ClusterOverview } from '../../../components/c4-cluster-overview/c4-cluster-overview.js';
|
|
@@ -48,7 +49,7 @@ function renderStrongTextTranslation(t, key, fallback, options) {
|
|
|
48
49
|
function isUuidLike(value) {
|
|
49
50
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
52
53
|
const { RadioButton, RadioButtonGroup } = useRadioFamily();
|
|
53
54
|
const c3Profile = useC3Profile();
|
|
54
55
|
const runtime = useC4ConsoleRuntime();
|
|
@@ -1593,3 +1594,6 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1593
1594
|
},
|
|
1594
1595
|
}, details: details, clusterLoad: clusterLoadProps, rbaNotification: rbaNotification, jobDashboard: jobDashboardEntryPoint }), isOptimizeDisabledForTrial && canEditCluster && isOptimizeModalOpen && (_jsx(C4OptimizeActivationModal, { open: isOptimizeModalOpen, description: safeTranslate(t, 'clusterdetails:overview.applications.optimize.disabled.modal.description', 'When enabled, the Optimize component is deployed alongside this cluster for process analytics and reporting.'), onClose: () => setIsOptimizeModalOpen(false), onActivate: activateOptimize }))] }));
|
|
1595
1596
|
};
|
|
1597
|
+
// Reads console data (upgradable generations, generation details) during render,
|
|
1598
|
+
// so it must be an observer to re-render when that data changes.
|
|
1599
|
+
export const C4ClusterDetailsOverviewTab = observer(C4ClusterDetailsOverviewTabImpl);
|
package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.d.ts
CHANGED
|
@@ -16,5 +16,7 @@ interface C4ClusterDetailsSecureConnectivityTabProps {
|
|
|
16
16
|
url?: string;
|
|
17
17
|
}) => void;
|
|
18
18
|
}
|
|
19
|
-
export declare const C4ClusterDetailsSecureConnectivityTab: (props: C4ClusterDetailsSecureConnectivityTabProps) => JSX.Element
|
|
19
|
+
export declare const C4ClusterDetailsSecureConnectivityTab: ((props: C4ClusterDetailsSecureConnectivityTabProps) => JSX.Element) & {
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
20
22
|
export {};
|
|
@@ -3,6 +3,7 @@ import { ConsoleSecureConnectivityService } from '@camunda/ccma-api';
|
|
|
3
3
|
import { isValidAwsArn, isValidPrivateLinkRegion, PRIVATE_LINK_REGIONS, SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT, SseEntity, } from '@camunda/ccma-shared-types';
|
|
4
4
|
import { ButtonSet, InlineLoading, ProgressIndicator, ProgressStep, } from '@carbon/react';
|
|
5
5
|
import { Checkmark, Close } from '@carbon/react/icons/index.esm.js';
|
|
6
|
+
import { observer } from 'mobx-react-lite';
|
|
6
7
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
8
|
import { C4ClusterDetailsSecureConnectivity } from '../../../components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
|
|
8
9
|
import { C4InlineNotification } from '../../../components/c4-inline-notification/c4-inline-notification.js';
|
|
@@ -44,7 +45,7 @@ function adaptSecureConnectivityStatus(options) {
|
|
|
44
45
|
},
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
const C4ClusterDetailsSecureConnectivityTabImpl = (props) => {
|
|
48
49
|
const { orgId, clusterId, apiConfig, canMutateCluster, isActive = true, t, docsUrls, onNavigate, } = props;
|
|
49
50
|
const docsUrl = docsUrls.secureConnectivity;
|
|
50
51
|
const data = useC4ConsoleData();
|
|
@@ -579,3 +580,6 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
579
580
|
})();
|
|
580
581
|
}, children: _jsxs(Stack, { gap: 4, children: [_jsx("p", { children: safeTranslate(t, 'clusterdetails:secureConnectivity.deactivateModalBody0', 'Are you sure you want to deactivate the PrivateLink endpoint service?') }), _jsx("p", { children: safeTranslate(t, 'clusterdetails:secureConnectivity.deactivateModalBody1', 'The private connectivity will be disabled for the Camunda cluster and all endpoint connections will be removed.') }), secureConnectivityMutationError ? (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, title: safeTranslate(t, 'clusterdetails:secureConnectivity.deactivateModalErrorTitle', 'Deactivation failed'), subtitle: secureConnectivityMutationError, onCloseButtonClick: () => setSecureConnectivityMutationError('') })) : undefined] }) })] }));
|
|
581
582
|
};
|
|
583
|
+
// Reads console data (clusters, SSE entity version) during render, so it must be
|
|
584
|
+
// an observer to re-render when that data changes.
|
|
585
|
+
export const C4ClusterDetailsSecureConnectivityTab = observer(C4ClusterDetailsSecureConnectivityTabImpl);
|
|
@@ -108,7 +108,7 @@ describe('C4ClustersPage', () => {
|
|
|
108
108
|
},
|
|
109
109
|
]);
|
|
110
110
|
vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([
|
|
111
|
-
{
|
|
111
|
+
{ clusterId: 'c1', ts: 0, avg: 0.42, min: 0.42, max: 0.42 },
|
|
112
112
|
]);
|
|
113
113
|
vi.mocked(OrgsService.getOrgInfo).mockResolvedValue({
|
|
114
114
|
uuid: 'org-1',
|
|
@@ -6,6 +6,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
import { C4ConnectorsContextProvider } from '@camunda/c4-connectors';
|
|
8
8
|
import { checkVersion, VersionCheckOperator } from '@camunda/ccma-shared-types';
|
|
9
|
+
import { useObserver } from 'mobx-react-lite';
|
|
9
10
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
10
11
|
import { C4_ASSET_URLS } from '../../assetUrls.js';
|
|
11
12
|
import { C4EmptyState } from '../../components/c4-empty-state/c4-empty-state.js';
|
|
@@ -35,9 +36,17 @@ export function useConnectorManagementRuntime(options) {
|
|
|
35
36
|
}
|
|
36
37
|
data.fetchClusters(orgId);
|
|
37
38
|
}, [orgId, data.fetchClusters]);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// Read the specific observable fields inside useObserver and return derived
|
|
40
|
+
// values, so this hook re-renders its caller (even a non-observer one)
|
|
41
|
+
// whenever the cache's loading state or cluster list changes — without
|
|
42
|
+
// depending on how the `clusters` getter materializes its entries.
|
|
43
|
+
const { isLoading, clusters } = useObserver(() => {
|
|
44
|
+
const cache = data.clusters[orgId];
|
|
45
|
+
return {
|
|
46
|
+
isLoading: cache?.isLoading ?? true,
|
|
47
|
+
clusters: Array.isArray(cache?.data) ? cache.data : [],
|
|
48
|
+
};
|
|
49
|
+
});
|
|
41
50
|
const cluster = useMemo(() => {
|
|
42
51
|
if (!clusterId) {
|
|
43
52
|
return undefined;
|
|
@@ -61,14 +61,16 @@ export const C4DashboardApp = observer((props) => {
|
|
|
61
61
|
const authz = useC4ConsoleAuthz({ orgId });
|
|
62
62
|
const data = useC4ConsoleData();
|
|
63
63
|
const externalUrls = useMemo(() => getC4DashboardUrls({ orgId, overrides: urls }), [orgId, urls]);
|
|
64
|
-
const { fetchClusters, fetchMembers, fetchAudits, fetchClusterCapacity, getClusters, } = data;
|
|
64
|
+
const { fetchClusters, fetchMembers, fetchAudits, fetchClients, fetchClusterCapacity, getClusters, } = data;
|
|
65
65
|
const orgInfo = data.getOrgInfo(orgId);
|
|
66
66
|
// Permissions derived from orgInfo. If orgInfo isn't loaded yet, default to
|
|
67
67
|
// not loading privileged data (members/activity). The dashboard should still render.
|
|
68
68
|
const canReadMembers = orgInfo?.permissions?.org?.users?.member?.read;
|
|
69
69
|
const canReadActivity = orgInfo?.permissions?.org?.activity?.read;
|
|
70
|
+
const canReadApiClients = orgInfo?.permissions?.org?.clients?.read;
|
|
70
71
|
const shouldLoadMembers = canReadMembers === true;
|
|
71
72
|
const shouldLoadActivity = canReadActivity === true;
|
|
73
|
+
const shouldLoadApiClients = canReadApiClients === true;
|
|
72
74
|
// Fetch data on mount/orgId change (idempotent, cached in context)
|
|
73
75
|
useEffect(() => {
|
|
74
76
|
if (!orgId)
|
|
@@ -122,6 +124,16 @@ export const C4DashboardApp = observer((props) => {
|
|
|
122
124
|
// Errors are surfaced via the shared cache.
|
|
123
125
|
});
|
|
124
126
|
}, [fetchAudits, orgId, shouldLoadActivity]);
|
|
127
|
+
// Load API clients (used for the "Admin APIs" overview tile) only when permitted.
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!orgId)
|
|
130
|
+
return;
|
|
131
|
+
if (!shouldLoadApiClients)
|
|
132
|
+
return;
|
|
133
|
+
fetchClients(orgId).catch(() => {
|
|
134
|
+
// Errors are surfaced via the shared cache.
|
|
135
|
+
});
|
|
136
|
+
}, [fetchClients, orgId, shouldLoadApiClients]);
|
|
125
137
|
useEffect(() => {
|
|
126
138
|
if (!orgId) {
|
|
127
139
|
return;
|
|
@@ -134,13 +146,16 @@ export const C4DashboardApp = observer((props) => {
|
|
|
134
146
|
const clustersCache = data.clusters[orgId];
|
|
135
147
|
const membersCache = data.members[orgId];
|
|
136
148
|
const auditsCache = data.audits[orgId];
|
|
149
|
+
const clientsCache = data.clients[orgId];
|
|
137
150
|
const clusterCapacityMap = data.clusterCapacity[orgId] ?? new Map();
|
|
138
151
|
const clusters = clustersCache?.data ?? [];
|
|
139
152
|
const members = membersCache?.data ?? [];
|
|
140
153
|
const audits = auditsCache?.data ?? [];
|
|
154
|
+
const clients = clientsCache?.data ?? [];
|
|
141
155
|
const error = clustersCache?.error ||
|
|
142
156
|
(shouldLoadMembers ? membersCache?.error : undefined) ||
|
|
143
|
-
(shouldLoadActivity ? auditsCache?.error : undefined)
|
|
157
|
+
(shouldLoadActivity ? auditsCache?.error : undefined) ||
|
|
158
|
+
(shouldLoadApiClients ? clientsCache?.error : undefined);
|
|
144
159
|
// Process audit logs for activity feed
|
|
145
160
|
const activityEntries = useMemo(() => {
|
|
146
161
|
if (!shouldLoadActivity) {
|
|
@@ -168,8 +183,9 @@ export const C4DashboardApp = observer((props) => {
|
|
|
168
183
|
};
|
|
169
184
|
});
|
|
170
185
|
}, [audits, members, shouldLoadActivity]);
|
|
171
|
-
// Process clusters for overview table
|
|
172
|
-
|
|
186
|
+
// Process clusters for overview table (memoized so the mapped array keeps a
|
|
187
|
+
// stable identity across re-renders and does not reset the table's page).
|
|
188
|
+
const clustersOverview = useMemo(() => clusters
|
|
173
189
|
.map((cluster) => {
|
|
174
190
|
const id = (typeof cluster?.uuid === 'string' && cluster.uuid) ||
|
|
175
191
|
(typeof cluster?.id === 'string' && cluster.id) ||
|
|
@@ -190,7 +206,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
190
206
|
version: cluster.generation?.name || '-',
|
|
191
207
|
};
|
|
192
208
|
})
|
|
193
|
-
.filter((cluster) => Boolean(cluster));
|
|
209
|
+
.filter((cluster) => Boolean(cluster)), [clusters]);
|
|
194
210
|
// Check if any cluster has load data
|
|
195
211
|
const clusterLoadAvailable = clusterCapacityMap.size > 0;
|
|
196
212
|
// Get cluster load callback
|
|
@@ -247,6 +263,8 @@ export const C4DashboardApp = observer((props) => {
|
|
|
247
263
|
reservationAvailable;
|
|
248
264
|
// Count members
|
|
249
265
|
const usersCount = shouldLoadMembers ? members.length : 0;
|
|
266
|
+
// Count Admin API clients (mirrors the Administration API tab's client list).
|
|
267
|
+
const clientsCount = shouldLoadApiClients ? clients.length : 0;
|
|
250
268
|
const salesPlanType = orgInfo?.organizationToSalesPlan?.salesPlan?.salesPlanType;
|
|
251
269
|
const isTrialOrg = salesPlanType === 'trial';
|
|
252
270
|
// Mirrors the "trial expired" gating used elsewhere in Console (e.g. the
|
|
@@ -339,7 +357,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
339
357
|
}, displayFirstCTA: false }));
|
|
340
358
|
}
|
|
341
359
|
// Render dashboard component
|
|
342
|
-
return (_jsx(C4ConsoleDashboard, { orgId: orgId, usersAmount: canViewUsers ? (shouldLoadMembers ? usersCount : 'N/A') : 'N/A', taskUsersAmount: billing?.taskUsersAmount || 0, clustersAmount: clusters.length, clientsAmount:
|
|
360
|
+
return (_jsx(C4ConsoleDashboard, { orgId: orgId, usersAmount: canViewUsers ? (shouldLoadMembers ? usersCount : 'N/A') : 'N/A', taskUsersAmount: billing?.taskUsersAmount || 0, clustersAmount: clusters.length, clientsAmount: clientsCount, clusters: clustersOverview, clusterLoadAvailable: clusterLoadAvailable, processInstancesChart: {
|
|
343
361
|
title: '',
|
|
344
362
|
theme,
|
|
345
363
|
axes: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "Camunda",
|
|
15
15
|
"type": "module",
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"**/*.css",
|
|
18
|
+
"**/*.scss"
|
|
19
|
+
],
|
|
16
20
|
"main": "./lib/esm/index.js",
|
|
17
21
|
"types": "./lib/esm/index.d.ts",
|
|
18
22
|
"files": [
|
|
@@ -56,7 +60,7 @@
|
|
|
56
60
|
"rimraf": "6.1.3",
|
|
57
61
|
"storybook": "10.4.6",
|
|
58
62
|
"styled-components": "6.4.2",
|
|
59
|
-
"@camunda/camunda-composite-components": "0.25.
|
|
63
|
+
"@camunda/camunda-composite-components": "0.25.4"
|
|
60
64
|
},
|
|
61
65
|
"peerDependencies": {
|
|
62
66
|
"@camunda/c4-connectors": "1.x",
|
|
@@ -80,8 +84,7 @@
|
|
|
80
84
|
"mobx": "6.16.1",
|
|
81
85
|
"mobx-react-lite": "4.1.1",
|
|
82
86
|
"mobx-state-tree": "7.2.0",
|
|
83
|
-
"
|
|
84
|
-
"@camunda/ccma-api": "0.3.0",
|
|
87
|
+
"@camunda/ccma-api": "0.4.0",
|
|
85
88
|
"@camunda/ccma-shared-types": "0.4.0"
|
|
86
89
|
},
|
|
87
90
|
"scripts": {
|