@camunda/ccma-saas-frontend 0.0.36 → 0.0.38

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 (61) hide show
  1. package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.d.ts +1 -1
  2. package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.js +10 -4
  3. package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.types.d.ts +2 -0
  4. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +39 -28
  5. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +2 -1
  6. package/lib/esm/components/c4-cluster-list/c4-cluster-list.waiting.spec.d.ts +1 -0
  7. package/lib/esm/components/c4-cluster-list/c4-cluster-list.waiting.spec.js +87 -0
  8. package/lib/esm/components/c4-cluster-overview/applications.d.ts +5 -1
  9. package/lib/esm/components/c4-cluster-overview/applications.js +70 -9
  10. package/lib/esm/components/c4-cluster-overview/applications.spec.d.ts +1 -0
  11. package/lib/esm/components/c4-cluster-overview/applications.spec.js +32 -0
  12. package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +8 -0
  13. package/lib/esm/components/c4-cluster-overview/cluster-details.js +26 -7
  14. package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.js +1 -1
  15. package/lib/esm/components/c4-page-template/c4-page-template.d.ts +1 -0
  16. package/lib/esm/components/c4-page-template/c4-page-template.js +1 -1
  17. package/lib/esm/externalUrls.const.d.ts +2 -1
  18. package/lib/esm/externalUrls.const.js +2 -1
  19. package/lib/esm/i18n/c4-console-i18n.js +0 -5
  20. package/lib/esm/i18n/en/pages/clusterdetails.json +13 -1
  21. package/lib/esm/i18n/en/pages/createcluster.json +1 -1
  22. package/lib/esm/runtime/build-cluster-swagger-url.d.ts +17 -0
  23. package/lib/esm/runtime/build-cluster-swagger-url.js +44 -0
  24. package/lib/esm/runtime/c4-console-authz.d.ts +1 -0
  25. package/lib/esm/runtime/c4-console-authz.js +4 -3
  26. package/lib/esm/runtime/c4-console-authz.spec.js +6 -2
  27. package/lib/esm/runtime/to-api-domain.d.ts +25 -0
  28. package/lib/esm/runtime/to-api-domain.js +46 -0
  29. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +5 -5
  30. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +40 -20
  31. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.spec.js +26 -0
  32. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +3 -2
  33. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +18 -2
  34. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +9 -2
  35. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +1 -1
  36. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +1 -0
  37. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +69 -34
  38. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +142 -0
  39. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +47 -13
  40. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.spec.js +74 -1
  41. package/lib/esm/widgets/clusters/c4-clusters-page.js +5 -8
  42. package/lib/esm/widgets/clusters/c4-clusters-page.spec.js +97 -15
  43. package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +2 -1
  44. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +1 -1
  45. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +3 -14
  46. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +0 -1
  47. package/lib/esm/widgets/dashboard/c4-dashboard-app.js +5 -2
  48. package/lib/esm/widgets/group-details/c4-group-details-page.d.ts +1 -1
  49. package/lib/esm/widgets/group-details/c4-group-details-page.js +35 -26
  50. package/lib/esm/widgets/group-details/c4-group-details-page.types.d.ts +0 -1
  51. package/lib/esm/widgets/is-cluster-reconciliation-paused.d.ts +6 -0
  52. package/lib/esm/widgets/is-cluster-reconciliation-paused.js +54 -0
  53. package/lib/esm/widgets/management/c4-management-app.js +12 -0
  54. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.d.ts +2 -1
  55. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +33 -27
  56. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.spec.d.ts +1 -0
  57. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.spec.js +246 -0
  58. package/lib/esm/widgets/user-details/c4-user-details-page.d.ts +1 -1
  59. package/lib/esm/widgets/user-details/c4-user-details-page.js +42 -67
  60. package/lib/esm/widgets/user-details/c4-user-details-page.types.d.ts +0 -1
  61. package/package.json +16 -16
@@ -12,6 +12,22 @@ import { C4ConsoleRuntimeProvider } from '../../runtime/c4-console-runtime-conte
12
12
  import { C4ClustersPage } from './c4-clusters-page.js';
13
13
  let lastClusterListProps;
14
14
  let lastClustersEmptyStateProps;
15
+ const getDefaultAuthorization = () => ({
16
+ isLoading: false,
17
+ orgRoles: [],
18
+ features: {},
19
+ visibilities: {
20
+ clusters: {
21
+ canCreate: true,
22
+ canEdit: true,
23
+ canDelete: true,
24
+ canUpdateTag: true,
25
+ canSeeClusterLoad: true,
26
+ canWake: true,
27
+ },
28
+ },
29
+ });
30
+ let authzMock = getDefaultAuthorization();
15
31
  vi.mock('@camunda/ccma-api', async () => {
16
32
  const actual = await vi.importActual('@camunda/ccma-api');
17
33
  return {
@@ -39,21 +55,7 @@ vi.mock('@camunda/ccma-api', async () => {
39
55
  vi.mock('../../runtime/c4-console-authz', () => {
40
56
  return {
41
57
  useC4ConsoleAuthz: () => {
42
- return {
43
- isLoading: false,
44
- orgRoles: [],
45
- features: {},
46
- visibilities: {
47
- clusters: {
48
- canCreate: true,
49
- canEdit: true,
50
- canDelete: true,
51
- canUpdateTag: true,
52
- canSeeClusterLoad: true,
53
- canWake: true,
54
- },
55
- },
56
- };
58
+ return authzMock;
57
59
  },
58
60
  };
59
61
  });
@@ -75,6 +77,7 @@ vi.mock('../../components/c4-clusters-empty-state/c4-clusters-empty-state', () =
75
77
  });
76
78
  describe('C4ClustersPage', () => {
77
79
  beforeEach(() => {
80
+ authzMock = getDefaultAuthorization();
78
81
  lastClusterListProps = undefined;
79
82
  lastClustersEmptyStateProps = undefined;
80
83
  vi.mocked(ConsoleClusterService.getClusters).mockReset();
@@ -147,6 +150,85 @@ describe('C4ClustersPage', () => {
147
150
  clusterId: 'c1',
148
151
  });
149
152
  });
153
+ it('marks spec or legacy-label paused clusters as maintenance and suppresses update suffix', async () => {
154
+ authzMock.features = {
155
+ console: {
156
+ clusters: {
157
+ canUpgradeGeneration: true,
158
+ },
159
+ },
160
+ };
161
+ vi.mocked(ConsoleClusterService.getClusters).mockResolvedValue([
162
+ {
163
+ uuid: 'cluster-normal',
164
+ name: 'Cluster normal',
165
+ generation: '8.8',
166
+ generationUuid: 'gen-normal',
167
+ type: 'prod',
168
+ region: 'eu',
169
+ status: { ready: 'healthy' },
170
+ labels: { camunda: ['dev'], custom: [] },
171
+ },
172
+ {
173
+ uuid: 'cluster-spec-paused',
174
+ name: 'Cluster spec paused',
175
+ generation: '8.8',
176
+ generationUuid: 'gen-spec-paused',
177
+ type: 'prod',
178
+ region: 'eu',
179
+ status: { ready: 'healthy' },
180
+ labels: { camunda: ['dev'], custom: [] },
181
+ spec: { reconciliation: { paused: true } },
182
+ },
183
+ {
184
+ uuid: 'cluster-label-paused',
185
+ name: 'Cluster label paused',
186
+ generation: '8.8',
187
+ generationUuid: 'gen-label-paused',
188
+ type: 'prod',
189
+ region: 'eu',
190
+ status: { ready: 'healthy' },
191
+ labels: { camunda: ['dev'], custom: [] },
192
+ metadata: {
193
+ labels: { 'cloud.camunda.io/pauseReconciliation': 'true' },
194
+ },
195
+ },
196
+ ]);
197
+ vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([]);
198
+ vi.mocked(GenerationService.getUpgradable).mockResolvedValue([
199
+ { uuid: 'target-gen' },
200
+ ]);
201
+ vi.mocked(OrgsService.getOrgInfo).mockResolvedValue({
202
+ uuid: 'org-1',
203
+ organizationToSalesPlan: {
204
+ trialStateExpired: false,
205
+ salesPlan: {
206
+ salesPlanType: 'trial',
207
+ },
208
+ trialExpirationDate: new Date(Date.now() + 10 * 24 * 60 * 60 * 1000).toISOString(),
209
+ },
210
+ });
211
+ render(_jsx(C4ConsoleRuntimeProvider, { config: {
212
+ stage: 'dev',
213
+ auth: {
214
+ getAccessToken: async () => 'token',
215
+ },
216
+ backendUrls: {},
217
+ }, children: _jsx(C4ConsoleDataProvider, { children: _jsx(C4ClustersPage, { orgId: 'org-1' }) }) }));
218
+ await waitFor(() => {
219
+ expect(lastClusterListProps?.clusters).toHaveLength(3);
220
+ const normalCluster = lastClusterListProps?.clusters.find((cluster) => cluster.id === 'cluster-normal');
221
+ expect(normalCluster?.generation).toContain('update available');
222
+ const specPausedCluster = lastClusterListProps?.clusters.find((cluster) => cluster.id === 'cluster-spec-paused');
223
+ expect(specPausedCluster?.status).toBe('maintenance');
224
+ expect(specPausedCluster?.generation).toBe('8.8');
225
+ expect(specPausedCluster?.generation).not.toContain('update available');
226
+ const labelPausedCluster = lastClusterListProps?.clusters.find((cluster) => cluster.id === 'cluster-label-paused');
227
+ expect(labelPausedCluster?.status).toBe('maintenance');
228
+ expect(labelPausedCluster?.generation).toBe('8.8');
229
+ expect(labelPausedCluster?.generation).not.toContain('update available');
230
+ });
231
+ });
150
232
  it('merges permissionsOverride into derived permissions', async () => {
151
233
  vi.mocked(ConsoleClusterService.getClusters).mockResolvedValue([]);
152
234
  vi.mocked(HdpService.getClusterCapacity).mockResolvedValue([]);
@@ -8,6 +8,7 @@ import { C4ConnectorsContextProvider } from '@camunda/c4-connectors';
8
8
  import { C3EmptyState } from '@camunda/camunda-composite-components';
9
9
  import { useEffect, useMemo, useState } from 'react';
10
10
  import { C4_ASSET_URLS } from '../../assetUrls.js';
11
+ import { C4_EXTERNAL_URLS } from '../../externalUrls.const.js';
11
12
  import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
12
13
  import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
13
14
  function isRecord(value) {
@@ -65,7 +66,7 @@ export function useConnectorManagementRuntime(options) {
65
66
  if (!connectorsUrl || !accessToken) {
66
67
  return _jsx(_Fragment, { children: children });
67
68
  }
68
- return (_jsx(C4ConnectorsContextProvider, { organizationId: orgId, apiBaseUrl: connectorsUrl, docsUrl: 'https://docs.camunda.io/docs/components/connectors/manage-connectors/', camundaAuth: {
69
+ return (_jsx(C4ConnectorsContextProvider, { organizationId: orgId, apiBaseUrl: connectorsUrl, docsUrl: C4_EXTERNAL_URLS.docs.consoleManageConnectors, camundaAuth: {
69
70
  token: accessToken,
70
71
  refreshTokenMethod: () => runtime.auth.getAccessToken(),
71
72
  }, children: children }));
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
2
  import type { C4CreateClusterPageProps } from './c4-create-cluster-page.types';
3
- export declare const C4CreateClusterPage: (({ orgId, afterCreateModalUrl, talkToAnExpertUrl, externalLinks, visibilities, onNavigate, }: C4CreateClusterPageProps) => React.ReactElement) & {
3
+ export declare const C4CreateClusterPage: (({ orgId, afterCreateModalUrl, talkToAnExpertUrl, externalLinks, onNavigate, }: C4CreateClusterPageProps) => React.ReactElement) & {
4
4
  displayName: string;
5
5
  };
@@ -236,7 +236,7 @@ function buildCreateClusterTranslations(t) {
236
236
  stageSleepInactivity: translate('clusterdetails:settings.tags.sleepInactivity', 'Auto-pauses after inactivity'),
237
237
  };
238
238
  }
239
- export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkToAnExpertUrl, externalLinks, visibilities, onNavigate, }) => {
239
+ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkToAnExpertUrl, externalLinks, onNavigate, }) => {
240
240
  const runtime = useC4ConsoleRuntime();
241
241
  const data = useC4ConsoleData();
242
242
  const resolvedTalkToAnExpertUrl = useMemo(() => talkToAnExpertUrl ??
@@ -250,19 +250,6 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
250
250
  const links = useMemo(() => {
251
251
  return resolveExternalLinks(externalLinks);
252
252
  }, [externalLinks]);
253
- const visibilitiesRecord = useMemo(() => {
254
- return isRecord(visibilities) ? visibilities : {};
255
- }, [visibilities]);
256
- const alphaAsDefault = getPathBoolean(visibilitiesRecord, [
257
- 'clusterList',
258
- 'experimentAlphaChannel',
259
- 'alphaAsDefault',
260
- ]) ?? false;
261
- const advancedOfferingVisible = getPathBoolean(visibilitiesRecord, [
262
- 'features',
263
- 'advancedOffering',
264
- 'visible',
265
- ]) ?? false;
266
253
  const [creationParameters, setCreationParameters] = useState({});
267
254
  const [creationParametersLoading, setCreationParametersLoading] = useState(false);
268
255
  const [organizations, setOrganizations] = useState([]);
@@ -350,6 +337,8 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
350
337
  const salesPlanName = useMemo(() => {
351
338
  return getPathString(organizationToSalesPlan, ['salesPlan', 'name']);
352
339
  }, [organizationToSalesPlan]);
340
+ const alphaAsDefault = salesPlanTypeRaw === SalesPlanType.TRIAL;
341
+ const advancedOfferingVisible = salesPlanTypeRaw === SalesPlanType.ENTERPRISE;
353
342
  const displayedSalesPlan = useMemo(() => {
354
343
  const trialStateExpired = getBoolean(organizationToSalesPlan, 'trialStateExpired') ?? false;
355
344
  if (!salesPlanTypeRaw) {
@@ -26,6 +26,5 @@ export interface C4CreateClusterPageProps {
26
26
  afterCreateModalUrl?: string;
27
27
  talkToAnExpertUrl?: string;
28
28
  externalLinks?: C4CreateClusterExternalLinks;
29
- visibilities?: unknown;
30
29
  onNavigate?: (event: C4CreateClusterNavigateEvent) => void;
31
30
  }
@@ -7,6 +7,7 @@ import { C4OldDashboard } from '../../components/c4-old-dashboard/c4-old-dashboa
7
7
  import { getC4DashboardUrls } from '../../externalUrls.const.js';
8
8
  import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
9
9
  import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
10
+ import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
10
11
  const DAY = 24 * 60 * 60 * 1000;
11
12
  function safeTranslate(t, key, fallback, options) {
12
13
  try {
@@ -180,7 +181,9 @@ export const C4DashboardApp = observer((props) => {
180
181
  return {
181
182
  id,
182
183
  name: cluster.name,
183
- status: cluster.status?.ready || 'Unknown',
184
+ status: isClusterReconciliationPaused(cluster)
185
+ ? 'maintenance'
186
+ : cluster.status?.ready || 'Unknown',
184
187
  tags: cluster.labels?.camunda?.length === 1
185
188
  ? cluster.labels.camunda[0]
186
189
  : '',
@@ -241,7 +244,7 @@ export const C4DashboardApp = observer((props) => {
241
244
  const clustersAmount = clusters.length;
242
245
  const healthyClustersAmount = clusters.filter((cluster) => {
243
246
  const ready = cluster?.status?.ready;
244
- return ready === true || ready === 'healthy';
247
+ return ready === true || ready?.toLowerCase?.() === 'healthy';
245
248
  }).length;
246
249
  return (_jsx(C4OldDashboard, { usersAmount: usersCount, invitationsAmount: invitationsAmount, clustersAmount: clustersAmount, healthyClustersAmount: healthyClustersAmount, updateAvailable: false, permissions: {
247
250
  showUsers: true,
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
2
  import type { C4GroupDetailsPageProps } from './c4-group-details-page.types';
3
- export declare const C4GroupDetailsPage: (({ orgId, groupId, externalLinks, visibilities, onNavigate, }: C4GroupDetailsPageProps) => React.ReactElement) & {
3
+ export declare const C4GroupDetailsPage: (({ orgId, groupId, externalLinks, onNavigate, }: C4GroupDetailsPageProps) => React.ReactElement) & {
4
4
  displayName: string;
5
5
  };
@@ -5,27 +5,18 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
5
5
  * You may not use this file except in compliance with the commercial license.
6
6
  */
7
7
  import { C4GroupsDetails, C4IdentityContextProvider, } from '@camunda/c4-identity';
8
- import { OrganizationRole } from '@camunda/ccma-shared-types';
8
+ import { checkVersion, OrganizationRole, VersionCheckOperator, } from '@camunda/ccma-shared-types';
9
9
  import { observer } from 'mobx-react-lite';
10
10
  import { useEffect, useMemo, useState } from 'react';
11
11
  import { C4PageTemplate } from '../../components/c4-page-template/c4-page-template.js';
12
12
  import { getC4GroupDetailsExternalLinks } from '../../externalUrls.const.js';
13
+ import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
13
14
  import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
14
15
  import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
15
16
  import { toIdentityApiBaseUrl } from '../../runtime/to-identity-api-base-url.js';
16
17
  function isRecord(value) {
17
18
  return Boolean(value) && typeof value === 'object';
18
19
  }
19
- function getPathBoolean(record, path) {
20
- let current = record;
21
- for (const key of path) {
22
- if (!isRecord(current)) {
23
- return false;
24
- }
25
- current = current[key];
26
- }
27
- return typeof current === 'boolean' ? current : false;
28
- }
29
20
  function safeTranslate(t, key, fallback) {
30
21
  try {
31
22
  const translated = t?.(key);
@@ -41,18 +32,26 @@ function sendNavigate(onNavigate, event) {
41
32
  function resolveLinks(links) {
42
33
  return getC4GroupDetailsExternalLinks(links);
43
34
  }
44
- export const C4GroupDetailsPage = observer(({ orgId, groupId, externalLinks, visibilities, onNavigate, }) => {
35
+ export const C4GroupDetailsPage = observer(({ orgId, groupId, externalLinks, onNavigate, }) => {
45
36
  const runtime = useC4ConsoleRuntime();
46
37
  const data = useC4ConsoleData();
38
+ const authz = useC4ConsoleAuthz({ orgId });
47
39
  const t = runtime.i18n?.t;
48
40
  const links = useMemo(() => resolveLinks(externalLinks), [externalLinks]);
49
- const visibilitiesRecord = useMemo(() => (isRecord(visibilities) ? visibilities : {}), [visibilities]);
41
+ const orgPermissions = authz.orgPermissions;
42
+ const hasClustersCache = Boolean(data.clusters[orgId]);
50
43
  useEffect(() => {
51
44
  if (!orgId) {
52
45
  return;
53
46
  }
54
47
  data.fetchMembers(orgId);
55
48
  }, [orgId, data.fetchMembers]);
49
+ useEffect(() => {
50
+ if (!orgId || hasClustersCache) {
51
+ return;
52
+ }
53
+ data.fetchClusters(orgId);
54
+ }, [data.fetchClusters, hasClustersCache, orgId]);
56
55
  const membersCache = data.members[orgId];
57
56
  const membersLoading = membersCache?.isLoading ?? true;
58
57
  const members = (membersCache?.data ?? []).filter(isRecord);
@@ -82,19 +81,29 @@ export const C4GroupDetailsPage = observer(({ orgId, groupId, externalLinks, vis
82
81
  return Boolean(invite.accepted);
83
82
  });
84
83
  }, [members]);
85
- const permissionsMaySee = getPathBoolean(visibilitiesRecord, [
86
- 'orgSettings',
87
- 'groups',
88
- 'visible',
89
- ]);
90
- const permissionsMayAssign = getPathBoolean(visibilitiesRecord, [
91
- 'orgSettings',
92
- 'groups',
93
- 'add',
94
- 'member',
95
- 'visible',
96
- ]);
97
- const hasAtLeastOneIdentityIntegrationCluster = getPathBoolean(visibilitiesRecord, ['features', 'hasAtLeastOneIdentityIntegrationCluster', 'visible']);
84
+ const permissionsMaySee = Boolean(orgPermissions?.org.users.member.read);
85
+ const permissionsMayAssign = Boolean(orgPermissions?.org.users.member.create);
86
+ const clustersCache = data.clusters[orgId];
87
+ const clusters = (clustersCache?.data ?? []);
88
+ const hasAtLeastOneIdentityIntegrationCluster = useMemo(() => {
89
+ return clusters.some((cluster) => {
90
+ const record = isRecord(cluster) ? cluster : {};
91
+ const generation = isRecord(record.generation) ? record.generation : {};
92
+ const versions = isRecord(generation.versions)
93
+ ? generation.versions
94
+ : {};
95
+ const zeebe = typeof versions.zeebe === 'string' ? versions.zeebe : undefined;
96
+ if (!zeebe?.includes(':')) {
97
+ return false;
98
+ }
99
+ return checkVersion({
100
+ possiblyVersionOrDockerPath: zeebe,
101
+ trueForSnapshot: true,
102
+ operator: VersionCheckOperator.GreaterThanOrEqual,
103
+ versionToCompareTo: '8.8.0-alpha5',
104
+ });
105
+ });
106
+ }, [clusters]);
98
107
  const getRoles = useMemo(() => {
99
108
  return async () => ({
100
109
  data: Object.values(OrganizationRole).map((role) => ({
@@ -12,6 +12,5 @@ export interface C4GroupDetailsPageProps {
12
12
  orgId: string;
13
13
  groupId: string;
14
14
  externalLinks?: C4GroupDetailsExternalLinks;
15
- visibilities?: unknown;
16
15
  onNavigate?: (event: C4GroupDetailsNavigateEvent) => void;
17
16
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true when reconciliation is paused via either:
3
+ * - `spec.reconciliation.paused` (current CRD field), or
4
+ * - `metadata.labels['cloud.camunda.io/pauseReconciliation']` (legacy label).
5
+ */
6
+ export declare function isClusterReconciliationPaused(cluster: unknown): boolean;
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. Licensed under a commercial license.
4
+ * You may not use this file except in compliance with the commercial license.
5
+ */
6
+ const LEGACY_PAUSE_RECONCILIATION_LABEL = 'cloud.camunda.io/pauseReconciliation';
7
+ /**
8
+ * Reads the legacy pause-reconciliation label from cluster metadata.
9
+ */
10
+ function readLegacyPauseLabel(clusterRecord) {
11
+ const metadata = clusterRecord.metadata;
12
+ if (!metadata || typeof metadata !== 'object') {
13
+ return false;
14
+ }
15
+ const labels = metadata.labels;
16
+ if (!labels) {
17
+ return false;
18
+ }
19
+ // Some call sites provide map-like label containers instead of plain objects.
20
+ if (labels instanceof Map) {
21
+ return labels.get(LEGACY_PAUSE_RECONCILIATION_LABEL) === 'true';
22
+ }
23
+ if (labels !== null && typeof labels === 'object') {
24
+ return (labels[LEGACY_PAUSE_RECONCILIATION_LABEL] ===
25
+ 'true');
26
+ }
27
+ return false;
28
+ }
29
+ /**
30
+ * Reads the CRD-native reconciliation pause flag from cluster spec.
31
+ */
32
+ function readSpecPauseFlag(clusterRecord) {
33
+ const spec = clusterRecord.spec;
34
+ if (!spec || typeof spec !== 'object') {
35
+ return false;
36
+ }
37
+ const reconciliation = spec.reconciliation;
38
+ if (!reconciliation || typeof reconciliation !== 'object') {
39
+ return false;
40
+ }
41
+ return reconciliation.paused === true;
42
+ }
43
+ /**
44
+ * Returns true when reconciliation is paused via either:
45
+ * - `spec.reconciliation.paused` (current CRD field), or
46
+ * - `metadata.labels['cloud.camunda.io/pauseReconciliation']` (legacy label).
47
+ */
48
+ export function isClusterReconciliationPaused(cluster) {
49
+ if (!cluster || typeof cluster !== 'object') {
50
+ return false;
51
+ }
52
+ const clusterRecord = cluster;
53
+ return readLegacyPauseLabel(clusterRecord) || readSpecPauseFlag(clusterRecord);
54
+ }
@@ -1263,6 +1263,18 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
1263
1263
  });
1264
1264
  await loadBilling();
1265
1265
  },
1266
+ onCreateUsageAlert: async (metric, threshold, enabled) => {
1267
+ await UsageAlertsService.create({
1268
+ config: apiConfig,
1269
+ params: {
1270
+ orgId,
1271
+ metric,
1272
+ threshold,
1273
+ enabled,
1274
+ },
1275
+ });
1276
+ await loadBilling();
1277
+ },
1266
1278
  t,
1267
1279
  };
1268
1280
  }, [
@@ -1,4 +1,4 @@
1
- import { type UsageAlertDto } from '@camunda/ccma-shared-types';
1
+ import { type UsageAlertDto, UsageAlertMetric } from '@camunda/ccma-shared-types';
2
2
  import type { JSX } from 'react';
3
3
  type Translate = (key: string, options?: Record<string, unknown>) => string;
4
4
  interface ClusterReservation {
@@ -37,6 +37,7 @@ export interface C4ManagementBillingTabProps {
37
37
  membersCount: number;
38
38
  changeTab: (tabId: string) => void;
39
39
  onUpdateUsageAlert: (alertId: string, threshold: number, enabled: boolean) => Promise<void>;
40
+ onCreateUsageAlert: (metric: UsageAlertMetric, threshold: number, enabled: boolean) => Promise<void>;
40
41
  t?: Translate;
41
42
  isLicensingModel2025?: boolean;
42
43
  }
@@ -4,7 +4,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
4
4
  * under one or more contributor license agreements. Licensed under a commercial license.
5
5
  * You may not use this file except in compliance with the commercial license.
6
6
  */
7
- import { UsageAlertMetric, UsageAlertThresholdLimits, } from '@camunda/ccma-shared-types';
7
+ import { UsageAlertInitValues, UsageAlertMetric, UsageAlertThresholdLimits, } from '@camunda/ccma-shared-types';
8
8
  import { Modal, Stack } from '@carbon/react';
9
9
  import { useState } from 'react';
10
10
  import { C4BillingPage } from '../../../components/c4-billing-page/c4-billing-page.js';
@@ -68,30 +68,28 @@ export const C4ManagementBillingTab = (props) => {
68
68
  return safeTranslate(props.t, 'orgmanagement:tabs.billing.usageAlerts.table.data.taskUsers', 'Task Users');
69
69
  }
70
70
  };
71
- const usageAlertsRows = props.billingUsageAlerts
72
- .slice()
73
- .filter((alert) => {
74
- if (props.isLicensingModel2025) {
75
- if (alert.metric === UsageAlertMetric.DECISION_INSTANCES ||
76
- alert.metric === UsageAlertMetric.TASK_USERS) {
77
- return false;
78
- }
79
- }
80
- switch (alert.metric) {
81
- case UsageAlertMetric.PROCESS_INSTANCES:
82
- return props.billingIncludedMetrics.processInstances > 0;
83
- case UsageAlertMetric.DECISION_INSTANCES:
84
- return props.billingIncludedMetrics.decisionInstances > 0;
85
- case UsageAlertMetric.TASK_USERS:
86
- return props.billingIncludedMetrics.taskUsers > 0;
87
- default:
88
- return false;
89
- }
90
- })
91
- .sort((a) => (a.metric === UsageAlertMetric.PROCESS_INSTANCES ? -1 : 1))
92
- .map((alert) => {
71
+ const allMetrics = props.isLicensingModel2025
72
+ ? [UsageAlertMetric.PROCESS_INSTANCES]
73
+ : [
74
+ UsageAlertMetric.PROCESS_INSTANCES,
75
+ UsageAlertMetric.DECISION_INSTANCES,
76
+ UsageAlertMetric.TASK_USERS,
77
+ ];
78
+ const existingByMetric = new Map(props.billingUsageAlerts.map((a) => [a.metric, a]));
79
+ const placeholderDate = new Date(0);
80
+ const mergedAlerts = allMetrics.map((metric) => existingByMetric.get(metric) ?? {
81
+ uuid: '',
82
+ created: placeholderDate,
83
+ createdBy: '',
84
+ updated: placeholderDate,
85
+ metric,
86
+ threshold: UsageAlertInitValues.threshold,
87
+ enabled: UsageAlertInitValues.enabled,
88
+ triggered: false,
89
+ });
90
+ const usageAlertsRows = mergedAlerts.map((alert) => {
93
91
  return {
94
- key: alert.uuid,
92
+ key: alert.uuid !== '' ? alert.uuid : `default-${alert.metric}`,
95
93
  metric: getMetricLabel(alert.metric),
96
94
  threshold: `${alert.threshold}%`,
97
95
  status: alert.enabled
@@ -243,6 +241,7 @@ export const C4ManagementBillingTab = (props) => {
243
241
  }
244
242
  const nextThreshold = usageAlertUpdateThreshold;
245
243
  const nextEnabled = usageAlertUpdateEnabled;
244
+ const isNewAlert = alert.uuid === '';
246
245
  const validate = () => {
247
246
  if (nextThreshold < UsageAlertThresholdLimits.min ||
248
247
  nextThreshold > UsageAlertThresholdLimits.max) {
@@ -253,13 +252,15 @@ export const C4ManagementBillingTab = (props) => {
253
252
  }));
254
253
  return false;
255
254
  }
256
- if (nextThreshold === alert.threshold &&
255
+ if (!isNewAlert &&
256
+ nextThreshold === alert.threshold &&
257
257
  nextEnabled === alert.enabled) {
258
258
  setUsageAlertUpdateInvalid(true);
259
259
  setUsageAlertUpdateInvalidText(safeTranslate(props.t, 'usagealerts:update.error.thresholdSame', 'No changes to save.'));
260
260
  return false;
261
261
  }
262
- if (nextEnabled === true &&
262
+ if (!isNewAlert &&
263
+ nextEnabled === true &&
263
264
  alert.triggered === true &&
264
265
  nextThreshold < alert.threshold) {
265
266
  setUsageAlertUpdateInvalid(true);
@@ -277,7 +278,12 @@ export const C4ManagementBillingTab = (props) => {
277
278
  void (async () => {
278
279
  setUsageAlertUpdateSaving(true);
279
280
  try {
280
- await props.onUpdateUsageAlert(alert.uuid, nextThreshold, nextEnabled);
281
+ if (isNewAlert) {
282
+ await props.onCreateUsageAlert(alert.metric, nextThreshold, nextEnabled);
283
+ }
284
+ else {
285
+ await props.onUpdateUsageAlert(alert.uuid, nextThreshold, nextEnabled);
286
+ }
281
287
  setUsageAlertUpdateModalOpen(false);
282
288
  setUsageAlertUpdateTarget(undefined);
283
289
  }