@camunda/ccma-saas-frontend 0.3.0 → 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.
Files changed (56) hide show
  1. package/lib/esm/components/c4-activity-graph/c4-activity-graph.d.ts +2 -2
  2. package/lib/esm/components/c4-activity-graph/c4-activity-graph.js +90 -73
  3. package/lib/esm/components/c4-advanced-search-filters/c4-advanced-search-filters.js +13 -13
  4. package/lib/esm/components/c4-billing-page/elements/current-usage-metrics.js +7 -1
  5. package/lib/esm/components/c4-charts-dashboard/c4-charts-dashboard.d.ts +1 -1
  6. package/lib/esm/components/c4-charts-dashboard/c4-charts-dashboard.js +31 -25
  7. package/lib/esm/components/c4-cluster-details-activity/c4-cluster-details-activity.js +11 -8
  8. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.d.ts +1 -1
  9. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +21 -20
  10. package/lib/esm/components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js +10 -2
  11. package/lib/esm/components/c4-cluster-overview/applications.d.ts +1 -1
  12. package/lib/esm/components/c4-cluster-overview/applications.js +7 -1
  13. package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +7 -1
  14. package/lib/esm/components/c4-data-table/c4-data-table.js +58 -4
  15. package/lib/esm/components/c4-data-table/c4-data-table.spec.js +52 -1
  16. package/lib/esm/components/c4-management-activity/c4-management-activity.d.ts +1 -1
  17. package/lib/esm/components/c4-management-activity/c4-management-activity.js +9 -4
  18. package/lib/esm/components/c4-management-settings/c4-management-settings.d.ts +1 -1
  19. package/lib/esm/components/c4-management-settings/c4-management-settings.js +9 -5
  20. package/lib/esm/components/c4-stackdriver-links/c4-stackdriver-links.js +3 -4
  21. package/lib/esm/components/c4-usage-history/c4-usage-history.d.ts +1 -1
  22. package/lib/esm/components/c4-usage-history/c4-usage-history.js +5 -2
  23. package/lib/esm/components/c4-usage-history/elements/usage-history-charts.d.ts +2 -2
  24. package/lib/esm/components/c4-usage-history/elements/usage-history-charts.js +6 -2
  25. package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.d.ts +1 -1
  26. package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.js +14 -8
  27. package/lib/esm/index.d.ts +1 -1
  28. package/lib/esm/index.js +1 -1
  29. package/lib/esm/runtime/c4-console-data-context.d.ts +17 -5
  30. package/lib/esm/runtime/c4-console-data-context.js +40 -15
  31. package/lib/esm/runtime/c4-console-data-context.spec.d.ts +1 -0
  32. package/lib/esm/runtime/c4-console-data-context.spec.js +354 -0
  33. package/lib/esm/runtime/c4-console-data-context.types.d.ts +6 -0
  34. package/lib/esm/runtime/c4-console-data-store.d.ts +11 -0
  35. package/lib/esm/runtime/c4-console-data-store.js +74 -34
  36. package/lib/esm/runtime/c4-console-data-store.nav.spec.js +1 -0
  37. package/lib/esm/runtime/c4-console-data-store.spec.js +147 -1
  38. package/lib/esm/runtime/c4-user-notifications-context.spec.js +2 -0
  39. package/lib/esm/runtime/nav/use-webapp-nav-data.js +11 -3
  40. package/lib/esm/runtime/to-api-config.d.ts +1 -1
  41. package/lib/esm/runtime/to-api-config.js +6 -0
  42. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +3 -1
  43. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +6 -1
  44. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.d.ts +3 -1
  45. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +5 -1
  46. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +3 -1
  47. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +5 -1
  48. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.d.ts +3 -1
  49. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +5 -1
  50. package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +1 -1
  51. package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.js +2 -1
  52. package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.js +10 -3
  53. package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -1
  54. package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +12 -3
  55. package/lib/esm/widgets/dashboard/c4-dashboard-app.js +24 -6
  56. package/package.json +8 -5
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
2
+ import { act, fireEvent, render, screen } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import { C4ConsoleRuntimeProvider } from '../../runtime/c4-console-runtime-context.js';
5
5
  import { C4DataTable } from './c4-data-table.js';
@@ -69,3 +69,54 @@ describe('C4DataTableDs multiSelect toolbar item', () => {
69
69
  expect(screen.getByText('Carol')).toBeInTheDocument();
70
70
  });
71
71
  });
72
+ function renderSearchTable() {
73
+ const wrapper = ({ children }) => (_jsx(C4ConsoleRuntimeProvider, { config: {
74
+ stage: 'dev',
75
+ designSystem: 'ds',
76
+ auth: { getAccessToken: async () => '' },
77
+ backendUrls: {},
78
+ }, children: children }));
79
+ return render(_jsx(C4DataTable, { headers: [{ key: 'name', label: 'Name' }], data: ROWS, toolbar: [
80
+ {
81
+ id: 'name-search',
82
+ type: 'search',
83
+ label: 'Search by name',
84
+ filter: ({ row, searchTerm }) => row.name.toLowerCase().includes((searchTerm ?? '').toLowerCase()),
85
+ },
86
+ ] }), { wrapper });
87
+ }
88
+ describe('C4DataTableDs search toolbar item', () => {
89
+ beforeEach(() => {
90
+ vi.useFakeTimers();
91
+ });
92
+ afterEach(() => {
93
+ act(() => {
94
+ vi.runOnlyPendingTimers();
95
+ });
96
+ vi.useRealTimers();
97
+ });
98
+ it('echoes typing instantly but defers row filtering until the debounce settles', () => {
99
+ renderSearchTable();
100
+ expect(screen.getByText('Alice')).toBeInTheDocument();
101
+ expect(screen.getByText('Bob')).toBeInTheDocument();
102
+ const input = screen.getByPlaceholderText('Search by name');
103
+ act(() => {
104
+ fireEvent.change(input, { target: { value: 'Alice' } });
105
+ });
106
+ // The input reflects the keystroke immediately...
107
+ expect(input.value).toBe('Alice');
108
+ // ...but the (potentially O(n)) row filter has not run yet.
109
+ expect(screen.getByText('Bob')).toBeInTheDocument();
110
+ // Still within the debounce window: no filtering yet.
111
+ act(() => {
112
+ vi.advanceTimersByTime(150);
113
+ });
114
+ expect(screen.getByText('Bob')).toBeInTheDocument();
115
+ // Debounce settles → filtering applies once.
116
+ act(() => {
117
+ vi.advanceTimersByTime(100);
118
+ });
119
+ expect(screen.queryByText('Bob')).not.toBeInTheDocument();
120
+ expect(screen.getByText('Alice')).toBeInTheDocument();
121
+ });
122
+ });
@@ -1,3 +1,3 @@
1
- import type { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  import type { C4ManagementActivityProps } from './c4-management-activity.types';
3
3
  export declare const C4ManagementActivity: (props: C4ManagementActivityProps) => JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
2
3
  import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
3
4
  import { Stack } from '../../ui/index.js';
4
5
  import { useMenuButtonFamily } from '../../ui/families.js';
@@ -48,7 +49,10 @@ const compareByTimestamp = (a, b) => {
48
49
  * existing (carbon) layout or its visual snapshots.
49
50
  */
50
51
  const C4ManagementActivityDs = ({ activities, loading, downloading, onExportJSON, onExportCSV, exportLabel, exportingLabel, exportJSONLabel, exportCSVLabel, searchLabel = 'Search activity', nameColumnLabel = 'Name', timestampColumnLabel = 'Timestamp', auditColumnLabel = 'Audit', }) => {
51
- const rows = activities
52
+ // Memoized so the mapped+sorted array keeps a stable identity across parent
53
+ // re-renders; a fresh array would reset the data table's page (TanStack
54
+ // `autoResetPageIndex`) and re-run the O(n log n) sort every render.
55
+ const rows = useMemo(() => activities
52
56
  .flatMap((activity) => activity.entries)
53
57
  .map((entry, index) => ({
54
58
  id: `activity-row-${index}`,
@@ -58,8 +62,9 @@ const C4ManagementActivityDs = ({ activities, loading, downloading, onExportJSON
58
62
  timestamp: entry.timestamp,
59
63
  audit: entry.entry,
60
64
  }))
61
- // Newest first by default, so the initial view matches the carbon layout;
62
- // ties keep their original order via the `originalIndex` tie-breaker.
65
+ // Newest first by default, so the initial view matches the carbon
66
+ // layout; ties keep their original order via the `originalIndex`
67
+ // tie-breaker.
63
68
  .sort((a, b) => {
64
69
  if (a.timestamp !== b.timestamp) {
65
70
  if (a.timestamp === undefined)
@@ -69,7 +74,7 @@ const C4ManagementActivityDs = ({ activities, loading, downloading, onExportJSON
69
74
  return b.timestamp - a.timestamp;
70
75
  }
71
76
  return a.originalIndex - b.originalIndex;
72
- });
77
+ }), [activities]);
73
78
  const headers = [
74
79
  {
75
80
  key: 'name',
@@ -1,3 +1,3 @@
1
- import type { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  import type { C4ManagementSettingsProps } from './c4-management-settings.types';
3
3
  export declare const C4ManagementSettings: ({ orgId: _orgId, organizationName: _organizationName, hasAcceptedBetaTerms, suppressDropDisks, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onToggleEarlyAccessFeature, onOptInToBeta, onOpenFeatureOptIn, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }: C4ManagementSettingsProps) => JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ConnectionSend, Renew, TrashCan } from '@carbon/react/icons/index.esm.js';
3
+ import { useMemo } from 'react';
3
4
  import { C4_ASSET_URLS } from '../../assetUrls.js';
4
5
  import { Button, Link, Stack } from '../../ui/index.js';
5
6
  import { C4ActionableNotification } from '../c4-actionable-notification/c4-actionable-notification.js';
@@ -77,14 +78,17 @@ export const C4ManagementSettings = ({ orgId: _orgId, organizationName: _organiz
77
78
  },
78
79
  },
79
80
  ];
81
+ // Transform early access features to include originalIndex for C3DataTable.
82
+ // Memoized (and kept above the loading guard so the hook runs unconditionally)
83
+ // so the array identity is stable across re-renders and does not reset the
84
+ // data table's page.
85
+ const tableData = useMemo(() => earlyAccessFeatures.map((feature, index) => ({
86
+ ...feature,
87
+ originalIndex: index,
88
+ })), [earlyAccessFeatures]);
80
89
  if (loading) {
81
90
  return _jsx(C4StructuredListSkeleton, { rowCount: 6 });
82
91
  }
83
- // Transform early access features to include originalIndex for C3DataTable
84
- const tableData = earlyAccessFeatures.map((feature, index) => ({
85
- ...feature,
86
- originalIndex: index,
87
- }));
88
92
  const component = (_jsxs(Stack, { gap: 6, children: [permissions.mayLeaveOrganization && (_jsx("div", { style: { marginTop: '10px' }, children: _jsxs("div", { style: {
89
93
  backgroundColor: 'var(--cds-layer)',
90
94
  padding: '20px',
@@ -1,8 +1,8 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
3
3
  export const C4StackDriverLinks = ({ query, }) => {
4
- const { unfiltered, papertrail } = generateLinks(query);
5
- return (_jsxs(_Fragment, { children: [_jsx(C4LinkButton, { inline: true, label: 'logs', onClick: () => window.open(unfiltered, '_blank') }), ' ', _jsx(C4LinkButton, { inline: true, label: 'papertrail', onClick: () => window.open(papertrail, '_blank') })] }));
4
+ const { unfiltered } = generateLinks(query);
5
+ return (_jsx(C4LinkButton, { inline: true, label: 'logs', onClick: () => window.open(unfiltered, '_blank', 'noopener,noreferrer') }));
6
6
  };
7
7
  function generateLinks(query) {
8
8
  let rawQuery;
@@ -21,6 +21,5 @@ function generateLinks(query) {
21
21
  const project = `camunda-saas-${query.stage}`;
22
22
  return {
23
23
  unfiltered: `https://console.cloud.google.com/logs/query;query=${encodeURI(rawQuery)}?project=${project}`,
24
- papertrail: `https://console.cloud.google.com/logs/query;query=${encodeURI(rawQuery)}%0AjsonPayload.paperTrail%3D%22true%22?project=${project}`,
25
24
  };
26
25
  }
@@ -1,3 +1,3 @@
1
- import type { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  import type { C4UsageHistoryProps } from './c4-usage-history.types';
3
3
  export declare const C4UsageHistory: ({ data, loading, }: C4UsageHistoryProps) => JSX.Element;
@@ -5,6 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
5
5
  * You may not use this file except in compliance with the commercial license.
6
6
  */
7
7
  import { ChartLineData, TableSplit } from '@carbon/react/icons/index.esm.js';
8
+ import { useMemo } from 'react';
8
9
  import { SkeletonPlaceholder, Stack } from '../../ui/index.js';
9
10
  import { useTabsFamily } from '../../ui/tabs.js';
10
11
  import { C4DataTable } from '../c4-data-table/c4-data-table.js';
@@ -52,7 +53,9 @@ const SimpleHistory = ({ data, headers, displayingDataText, }) => {
52
53
  label: headers.generalUsers,
53
54
  },
54
55
  ];
55
- const rows = data.map((row, index) => {
56
+ // Memoized so the mapped array keeps a stable identity across re-renders and
57
+ // does not reset the data table's page.
58
+ const rows = useMemo(() => data.map((row, index) => {
56
59
  return {
57
60
  id: row.key,
58
61
  originalIndex: index,
@@ -64,7 +67,7 @@ const SimpleHistory = ({ data, headers, displayingDataText, }) => {
64
67
  taskUsers: row.taskUsers,
65
68
  generalUsers: row.generalUsers,
66
69
  };
67
- });
70
+ }), [data]);
68
71
  const displayingData = {
69
72
  prefix: displayingDataText,
70
73
  period: rows.length > 0
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  export interface LineChartDataPoint {
3
3
  group: string;
4
4
  date: string;
@@ -32,4 +32,4 @@ export interface UsageHistoryChartsProps {
32
32
  tu?: LineChartConfig;
33
33
  }
34
34
  export declare const UsageHistoryCharts: ({ pi, di, tu, }: UsageHistoryChartsProps) => JSX.Element;
35
- export declare const ValueMetricsLineChart: ({ axes, dataPoints, title, theme, thresholds, toolbar, zoomBar, height, }: LineChartConfig) => JSX.Element;
35
+ export declare const ValueMetricsLineChart: import("react").MemoExoticComponent<({ axes, dataPoints, title, theme, thresholds, toolbar, zoomBar, height, }: LineChartConfig) => JSX.Element>;
@@ -5,6 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  * You may not use this file except in compliance with the commercial license.
6
6
  */
7
7
  import { LineChart } from '@carbon/charts-react';
8
+ import { memo } from 'react';
8
9
  import { useC4DesignSystem } from '../../../runtime/c4-console-runtime-context.js';
9
10
  import { Stack } from '../../../ui/index.js';
10
11
  import { DsLineChart } from '../../shared-charts/ds-line-chart.js';
@@ -12,7 +13,10 @@ export const UsageHistoryCharts = ({ pi, di, tu, }) => {
12
13
  const component = (_jsxs(Stack, { gap: 4, children: [_jsx(ValueMetricsLineChart, { ...pi }), di && _jsx(ValueMetricsLineChart, { ...di }), tu && _jsx(ValueMetricsLineChart, { ...tu })] }));
13
14
  return component;
14
15
  };
15
- export const ValueMetricsLineChart = ({ axes, dataPoints, title, theme, thresholds, toolbar = { enabled: true }, zoomBar = { enabled: true }, height = 400, }) => {
16
+ // Memoized: the Carbon LineChart re-initializes its underlying D3 chart whenever
17
+ // the `data`/`options` identities change, so skip re-rendering (and rebuilding
18
+ // those objects) when the chart's props are unchanged.
19
+ export const ValueMetricsLineChart = memo(function ValueMetricsLineChart({ axes, dataPoints, title, theme, thresholds, toolbar = { enabled: true }, zoomBar = { enabled: true }, height = 400, }) {
16
20
  const designSystem = useC4DesignSystem();
17
21
  if (designSystem === 'ds') {
18
22
  return (_jsx(DsLineChart, { title: title, dataPoints: dataPoints, axes: axes, thresholds: thresholds, height: height, zoomBar: zoomBar }));
@@ -47,4 +51,4 @@ export const ValueMetricsLineChart = ({ axes, dataPoints, title, theme, threshol
47
51
  };
48
52
  const component = (_jsx(LineChart, { data: data.data, options: data.options }));
49
53
  return component;
50
- };
54
+ });
@@ -1,3 +1,3 @@
1
- import type { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  import type { C4UsageMetricsPerClusterProps } from './c4-usage-metrics-per-cluster.types';
3
3
  export declare const C4UsageMetricsPerCluster: ({ data, range, tags, texts, loading, download, }: C4UsageMetricsPerClusterProps) => JSX.Element;
@@ -7,6 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
7
  import { C3ClusterTag, } from '@camunda/camunda-composite-components';
8
8
  import { DatePicker, DatePickerInput } from '@carbon/react';
9
9
  import { Download } from '@carbon/react/icons/index.esm.js';
10
+ import { useMemo } from 'react';
10
11
  import { Button, MultiSelect, Stack } from '../../ui/index.js';
11
12
  import { C4DataTable } from '../c4-data-table/c4-data-table.js';
12
13
  import { C4DataTableSkeleton } from '../c4-data-table/c4-data-table-skeleton.js';
@@ -18,6 +19,19 @@ export const C4UsageMetricsPerCluster = ({ data, range, tags, texts, loading, do
18
19
  });
19
20
  }, children: [_jsx(DatePickerInput, { id: 'usage-metrics-start', placeholder: texts.range.placeHolder, labelText: texts.range.from, size: 'md' }), _jsx(DatePickerInput, { id: 'usage-metrics-end', placeholder: texts.range.placeHolder, labelText: texts.range.to, size: 'md' })] }));
20
21
  const tagsAvailable = tags.allTags.length > 0;
22
+ // Derive availability flags in a single pass each and memoize the transformed
23
+ // rows so their identity is stable across re-renders — a fresh array would
24
+ // reset the data table's page (TanStack `autoResetPageIndex`).
25
+ const licenseAvailable = data.some((item) => item?.license);
26
+ const tenantsAvailable = data.some((item) => typeof item?.activeTenants !== 'undefined');
27
+ const transformedData = useMemo(() => data.map((item, index) => ({
28
+ ...item,
29
+ activeTenants: tenantsAvailable
30
+ ? (item?.activeTenants ?? 0)
31
+ : undefined,
32
+ license: licenseAvailable ? (item?.license ?? '-') : undefined,
33
+ originalIndex: index,
34
+ })), [data, licenseAvailable, tenantsAvailable]);
21
35
  const compTagSelection = tagsAvailable ? (_jsx("div", { style: { marginTop: '-2px' }, children: _jsx(MultiSelect, { titleText: texts.tags, label: texts.tags, useTitleInItem: true, selectedItems: tags.values, id: 'cluster-usage-metrics-tag-selection', items: tags.allTags, onChange: (event) => {
22
36
  tags.onChange(event.selectedItems);
23
37
  } }) })) : null;
@@ -36,7 +50,6 @@ export const C4UsageMetricsPerCluster = ({ data, range, tags, texts, loading, do
36
50
  label: texts.data.version,
37
51
  },
38
52
  ];
39
- const licenseAvailable = data.some((item) => item?.license);
40
53
  if (licenseAvailable) {
41
54
  headers.push({
42
55
  key: 'license',
@@ -67,19 +80,12 @@ export const C4UsageMetricsPerCluster = ({ data, range, tags, texts, loading, do
67
80
  key: 'di',
68
81
  label: texts.data.di,
69
82
  });
70
- const tenantsAvailable = data.some((item) => typeof item?.activeTenants !== 'undefined');
71
83
  if (tenantsAvailable) {
72
84
  headers.push({
73
85
  key: 'activeTenants',
74
86
  label: 'Tenants',
75
87
  });
76
88
  }
77
- const transformedData = data.map((item, index) => ({
78
- ...item,
79
- activeTenants: tenantsAvailable ? (item?.activeTenants ?? 0) : undefined,
80
- license: licenseAvailable ? (item?.license ?? '-') : undefined,
81
- originalIndex: index,
82
- }));
83
89
  const toolbar = [
84
90
  {
85
91
  id: 'search',
@@ -55,7 +55,7 @@ export type { C4ClusterDetailsSecureConnectivityProps, C4ClusterDetailsSecureCon
55
55
  export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list';
56
56
  export type { C4ClusterListProps, ClusterListItem, ClusterListNotification, ClusterListPermissions, ClusterListUrls, } from './components/c4-cluster-list/c4-cluster-list.types';
57
57
  export type { ApplicationsProps, ApplicationTileProps, ClusterStatus, } from './components/c4-cluster-overview/applications';
58
- export { ClusterStatusElement } from './components/c4-cluster-overview/applications';
58
+ export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications';
59
59
  export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, } from './components/c4-cluster-overview/c4-cluster-overview';
60
60
  export type { C4ClusterOverviewProps, RbaNotificationProps, } from './components/c4-cluster-overview/c4-cluster-overview.types';
61
61
  export type { ClusterDetailsGenerationUpdateProps, ClusterDetailsProps, } from './components/c4-cluster-overview/cluster-details';
package/lib/esm/index.js CHANGED
@@ -31,7 +31,7 @@ export { C4ClusterDetailsHotBackupsRestore } from './components/c4-cluster-detai
31
31
  export { C4ClusterDetailsIpWhitelist } from './components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js';
32
32
  export { C4ClusterDetailsSecureConnectivity } from './components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
33
33
  export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
34
- export { ClusterStatusElement } from './components/c4-cluster-overview/applications.js';
34
+ export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
35
35
  export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, } from './components/c4-cluster-overview/c4-cluster-overview.js';
36
36
  export { C4ClusterSettings } from './components/c4-cluster-settings/c4-cluster-settings.js';
37
37
  export { C4ClusterTagSelector } from './components/c4-cluster-tag-selector/c4-cluster-tag-selector.js';
@@ -26,13 +26,25 @@ export declare const C4ConsoleDataProvider: ({ children, initialState, }: C4Cons
26
26
  *
27
27
  * Must be used within C4ConsoleDataProvider.
28
28
  *
29
+ * ⚠️ Reactivity: the context value returned here is now **stable** — it no
30
+ * longer changes on every store mutation. The data getters read MobX
31
+ * observables lazily, so a component that reads data from this hook during
32
+ * render (e.g. `data.getClusters(orgId)`) MUST be wrapped in `observer()` from
33
+ * `mobx-react-lite` to re-render when that data changes. Components that only
34
+ * call actions (`data.fetchClusters(...)`) in effects/handlers do not need it.
35
+ * Custom hooks that read data during render should wrap the read in
36
+ * `useObserver(() => ...)` so their (possibly non-observer) caller re-renders.
37
+ *
29
38
  * @example
30
- * const data = useC4ConsoleData()
39
+ * const MyWidget = observer(({ orgId }) => {
40
+ * const data = useC4ConsoleData()
31
41
  *
32
- * useEffect(() => {
33
- * data.fetchClusters(orgId)
34
- * }, [orgId])
42
+ * useEffect(() => {
43
+ * data.fetchClusters(orgId)
44
+ * }, [data, orgId])
35
45
  *
36
- * const clusters = data.getClusters(orgId) ?? []
46
+ * const clusters = data.getClusters(orgId) ?? []
47
+ * return <ClusterList clusters={clusters} />
48
+ * })
37
49
  */
38
50
  export declare const useC4ConsoleData: () => C4ConsoleDataState;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SseEntity, SseType } from '@camunda/ccma-shared-types';
3
- import { onSnapshot } from 'mobx-state-tree';
4
- import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
3
+ import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, } from 'react';
5
4
  import { addC4ConsoleNotification } from '../notifications/c4-console-notifications-handle.js';
6
5
  import { ConsoleDataStore, } from './c4-console-data-store.js';
7
6
  import { useC4ConsoleRuntime } from './c4-console-runtime-context.js';
@@ -36,6 +35,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
36
35
  earlyAccessFeatures: {},
37
36
  members: {},
38
37
  audits: {},
38
+ clients: {},
39
39
  clusterCapacity: {},
40
40
  upgradableGenerations: {},
41
41
  generationDetails: {},
@@ -43,13 +43,6 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
43
43
  ...initialStateRef.current,
44
44
  });
45
45
  }, []);
46
- // Re-render provider consumers whenever the MST store changes.
47
- const [storeVersion, setStoreVersion] = useState(0);
48
- useEffect(() => {
49
- return onSnapshot(store, () => {
50
- setStoreVersion((prev) => prev + 1);
51
- });
52
- }, [store]);
53
46
  // Inject runtime config into store before child effects run
54
47
  useLayoutEffect(() => {
55
48
  store.setRuntime(runtime);
@@ -59,6 +52,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
59
52
  const fetchOrgInfo = useCallback((orgId, options) => store.fetchOrgInfo(orgId, options), [store]);
60
53
  const fetchMembers = useCallback((orgId, options) => store.fetchMembers(orgId, options), [store]);
61
54
  const fetchAudits = useCallback((orgId, options) => store.fetchAudits(orgId, options), [store]);
55
+ const fetchClients = useCallback((orgId, options) => store.fetchClients(orgId, options), [store]);
62
56
  const fetchOrgOwner = useCallback((orgId, options) => store.fetchOrgOwner(orgId, options), [store]);
63
57
  const fetchEarlyAccessFeatures = useCallback((orgId, options) => store.fetchEarlyAccessFeatures(orgId, options), [store]);
64
58
  const fetchClusterCapacity = useCallback((orgId, clusterIds, options) => store.fetchClusterCapacity(orgId, clusterIds, options), [store]);
@@ -74,6 +68,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
74
68
  const invalidateClusterCapacity = useCallback((orgId) => store.invalidateClusterCapacity(orgId), [store]);
75
69
  const invalidateMembers = useCallback((orgId) => store.invalidateMembers(orgId), [store]);
76
70
  const invalidateAudits = useCallback((orgId) => store.invalidateAudits(orgId), [store]);
71
+ const invalidateClients = useCallback((orgId) => store.invalidateClients(orgId), [store]);
77
72
  const invalidateMyOrgs = useCallback(() => store.invalidateMyOrgs(), [store]);
78
73
  const invalidateWebappClusters = useCallback((orgId) => store.invalidateWebappClusters(orgId), [store]);
79
74
  const invalidateAll = useCallback((orgId) => store.invalidateAll(orgId), [store]);
@@ -83,6 +78,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
83
78
  const getEarlyAccessFeatures = useCallback((orgId) => store.getEarlyAccessFeatures(orgId), [store]);
84
79
  const getMembers = useCallback((orgId) => store.getMembers(orgId), [store]);
85
80
  const getAudits = useCallback((orgId) => store.getAudits(orgId), [store]);
81
+ const getClients = useCallback((orgId) => store.getClients(orgId), [store]);
86
82
  const getClusterCapacity = useCallback((orgId, clusterId) => store.getClusterCapacity(orgId, clusterId), [store]);
87
83
  const getMyOrgs = useCallback(() => store.getMyOrgs(), [store]);
88
84
  const getWebappClusters = useCallback((orgId) => store.getWebappClusters(orgId), [store]);
@@ -162,6 +158,18 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
162
158
  });
163
159
  return result;
164
160
  },
161
+ get clients() {
162
+ const result = {};
163
+ store.clients.forEach((value, key) => {
164
+ result[key] = {
165
+ data: value.data,
166
+ isLoading: value.isLoading,
167
+ error: (value.error ?? undefined),
168
+ lastFetched: value.lastFetched ?? undefined,
169
+ };
170
+ });
171
+ return result;
172
+ },
165
173
  get clusterCapacity() {
166
174
  const result = {};
167
175
  store.clusterCapacity.forEach((value, key) => {
@@ -221,6 +229,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
221
229
  fetchEarlyAccessFeatures,
222
230
  fetchMembers,
223
231
  fetchAudits,
232
+ fetchClients,
224
233
  fetchClusterCapacity,
225
234
  fetchMyOrgs,
226
235
  fetchWebappClusters,
@@ -235,6 +244,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
235
244
  invalidateClusterCapacity,
236
245
  invalidateMembers,
237
246
  invalidateAudits,
247
+ invalidateClients,
238
248
  invalidateMyOrgs,
239
249
  invalidateWebappClusters,
240
250
  invalidateAll,
@@ -245,6 +255,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
245
255
  getEarlyAccessFeatures,
246
256
  getMembers,
247
257
  getAudits,
258
+ getClients,
248
259
  getClusterCapacity,
249
260
  getMyOrgs,
250
261
  getWebappClusters,
@@ -253,13 +264,13 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
253
264
  getGenerationDetails,
254
265
  }), [
255
266
  store,
256
- storeVersion,
257
267
  fetchClusters,
258
268
  fetchOrgInfo,
259
269
  fetchOrgOwner,
260
270
  fetchEarlyAccessFeatures,
261
271
  fetchMembers,
262
272
  fetchAudits,
273
+ fetchClients,
263
274
  fetchClusterCapacity,
264
275
  fetchMyOrgs,
265
276
  fetchWebappClusters,
@@ -273,6 +284,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
273
284
  invalidateClusterCapacity,
274
285
  invalidateMembers,
275
286
  invalidateAudits,
287
+ invalidateClients,
276
288
  invalidateMyOrgs,
277
289
  invalidateWebappClusters,
278
290
  invalidateAll,
@@ -282,6 +294,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
282
294
  getEarlyAccessFeatures,
283
295
  getMembers,
284
296
  getAudits,
297
+ getClients,
285
298
  getClusterCapacity,
286
299
  getMyOrgs,
287
300
  getWebappClusters,
@@ -353,14 +366,26 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
353
366
  *
354
367
  * Must be used within C4ConsoleDataProvider.
355
368
  *
369
+ * ⚠️ Reactivity: the context value returned here is now **stable** — it no
370
+ * longer changes on every store mutation. The data getters read MobX
371
+ * observables lazily, so a component that reads data from this hook during
372
+ * render (e.g. `data.getClusters(orgId)`) MUST be wrapped in `observer()` from
373
+ * `mobx-react-lite` to re-render when that data changes. Components that only
374
+ * call actions (`data.fetchClusters(...)`) in effects/handlers do not need it.
375
+ * Custom hooks that read data during render should wrap the read in
376
+ * `useObserver(() => ...)` so their (possibly non-observer) caller re-renders.
377
+ *
356
378
  * @example
357
- * const data = useC4ConsoleData()
379
+ * const MyWidget = observer(({ orgId }) => {
380
+ * const data = useC4ConsoleData()
358
381
  *
359
- * useEffect(() => {
360
- * data.fetchClusters(orgId)
361
- * }, [orgId])
382
+ * useEffect(() => {
383
+ * data.fetchClusters(orgId)
384
+ * }, [data, orgId])
362
385
  *
363
- * const clusters = data.getClusters(orgId) ?? []
386
+ * const clusters = data.getClusters(orgId) ?? []
387
+ * return <ClusterList clusters={clusters} />
388
+ * })
364
389
  */
365
390
  export const useC4ConsoleData = () => {
366
391
  const context = useContext(DataContext);
@@ -0,0 +1 @@
1
+ export {};