@camunda/ccma-saas-frontend 0.35.6 → 0.35.8

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.
@@ -91,7 +91,7 @@ export declare const ConsoleDataStore: import("mobx-state-tree").IModelType<{
91
91
  clustersLastRefreshMs: Map<string, number>;
92
92
  clusterCapacityLastRefreshMs: Map<string, number>;
93
93
  } & {
94
- getClusters(orgId: string): any[] | undefined;
94
+ getClusters(orgId: string): ConsoleClusterDto[] | undefined;
95
95
  getOrgInfo(orgId: string): unknown | undefined;
96
96
  getOrgInfoError(orgId: string): Error | undefined;
97
97
  getOrgOwner(orgId: string): {
@@ -3,10 +3,11 @@
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 { AuditLoggerService, ConsoleClusterService, EarlyAccessFeaturesService, ExternalAccountsService, ExternalConsoleService, GenerationService, HdpService, HttpError, OrganizationMembersService, OrgsService, } from '@camunda/ccma-api';
6
+ import { AuditLoggerService, EarlyAccessFeaturesService, ExternalAccountsService, ExternalConsoleService, GenerationService, HdpService, HttpError, OrganizationMembersService, OrgsService, } from '@camunda/ccma-api';
7
7
  import { SseEntity, SseType, } from '@camunda/ccma-shared-types';
8
8
  import { flow, types } from 'mobx-state-tree';
9
9
  import { toApiConfig } from './to-api-config.js';
10
+ import { cliClusterReadsApi } from './use-cli-cluster-reads-api.js';
10
11
  import { cliOrgApi, isConsoleCliApiOn } from './use-cli-org-api.js';
11
12
  function isRecord(value) {
12
13
  return typeof value === 'object' && value !== null;
@@ -546,15 +547,10 @@ export const ConsoleDataStore = types
546
547
  });
547
548
  try {
548
549
  const apiConfig = toApiConfig(self.runtime);
549
- const response = yield ConsoleClusterService.getClusters({
550
+ const clustersList = yield cliClusterReadsApi(isConsoleCliApiOn(self.runtime)).getClusters({
550
551
  params: { orgId },
551
552
  config: apiConfig,
552
553
  });
553
- const clustersList = Array.isArray(response)
554
- ? response
555
- : response?.clusters && Array.isArray(response.clusters)
556
- ? response.clusters
557
- : [];
558
554
  self.clusters.set(orgId, {
559
555
  data: clustersList,
560
556
  isLoading: false,
@@ -0,0 +1,48 @@
1
+ import type { ConsoleCliCluster, ConsoleCliClusterParameters, ConsoleClusterCreationParametersResponse, RequestBaseParamsConfig } from '@camunda/ccma-api';
2
+ import type { ConsoleClusterDto } from '@camunda/ccma-shared-types';
3
+ interface OrgRequest {
4
+ config: RequestBaseParamsConfig;
5
+ params: {
6
+ orgId: string;
7
+ };
8
+ }
9
+ interface ClusterRequest {
10
+ config: RequestBaseParamsConfig;
11
+ params: {
12
+ orgId: string;
13
+ clusterId: string;
14
+ };
15
+ }
16
+ /**
17
+ * Maps the `/cli/v1` cluster to the field names of the internal route, so
18
+ * that the readers and the SSE patches of the cache stay the same. A field
19
+ * that the CLI does not give stays out (see the PR of #11623 for the list).
20
+ */
21
+ export declare const toC4Cluster: (orgId: string, cluster: ConsoleCliCluster, fromList?: boolean) => ConsoleClusterDto & {
22
+ businessIdUniquenessEnabled?: boolean;
23
+ externalMetadata?: ConsoleClusterDto["externalMetadata"] & {
24
+ tasklistV2Enabled?: boolean;
25
+ };
26
+ };
27
+ /**
28
+ * Maps the `/cli/v1` create parameters to the shape of the internal route.
29
+ * The CLI marks the defaults itself, and `default` takes the place of
30
+ * `isDefault` and `defaultGeneration`.
31
+ */
32
+ export declare const toCreationParameters: (parameters: ConsoleCliClusterParameters) => ConsoleClusterCreationParametersResponse;
33
+ /**
34
+ * The cluster reads. They go to the `/cli/v1` routes when `cliApi` is on,
35
+ * else to the internal routes. Both give the shapes of the internal routes.
36
+ * Part of #11623: delete it with the flag.
37
+ */
38
+ export declare const cliClusterReadsApi: (cliApi: boolean) => {
39
+ getClusters: (request: OrgRequest) => Promise<ConsoleClusterDto[]>;
40
+ getCluster: (request: ClusterRequest) => Promise<ConsoleClusterDto>;
41
+ getCreationParameters: (request: OrgRequest) => Promise<ConsoleClusterCreationParametersResponse>;
42
+ };
43
+ export declare const useCliClusterReadsApi: () => {
44
+ getClusters: (request: OrgRequest) => Promise<ConsoleClusterDto[]>;
45
+ getCluster: (request: ClusterRequest) => Promise<ConsoleClusterDto>;
46
+ getCreationParameters: (request: OrgRequest) => Promise<ConsoleClusterCreationParametersResponse>;
47
+ };
48
+ export {};
@@ -0,0 +1,207 @@
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
+ import { ConsoleCliClusterService, ConsoleClusterParametersService, ConsoleClusterService, } from '@camunda/ccma-api';
7
+ import { useMemo } from 'react';
8
+ import { useConsoleCliApi } from './use-console-cli-api.js';
9
+ const toGeneration = (generation) => generation && {
10
+ uuid: generation.id,
11
+ name: generation.name,
12
+ versions: generation.versions,
13
+ };
14
+ /**
15
+ * Maps the `/cli/v1` cluster to the field names of the internal route, so
16
+ * that the readers and the SSE patches of the cache stay the same. A field
17
+ * that the CLI does not give stays out (see the PR of #11623 for the list).
18
+ */
19
+ export const toC4Cluster = (orgId, cluster,
20
+ // The list has no restore state. A list item leaves it out, so that a
21
+ // merge keeps the value of the detail.
22
+ fromList = false) => {
23
+ const update = cluster.update;
24
+ return {
25
+ uuid: cluster.id,
26
+ name: cluster.name,
27
+ description: cluster.description,
28
+ ownerId: orgId,
29
+ // The internal route sends the date as a string too. The DTO type is
30
+ // wrong about it.
31
+ created: cluster.createdAt,
32
+ status: {
33
+ ready: cluster.statusDetail ?? '',
34
+ zeebeStatus: cluster.health?.zeebe,
35
+ operateStatus: cluster.health?.operate,
36
+ tasklistStatus: cluster.health?.tasklist,
37
+ optimizeStatus: cluster.health?.optimize,
38
+ connectorsStatus: cluster.health?.connectors,
39
+ zeebeUrl: cluster.urls.zeebeGrpc,
40
+ zeebeRestUrl: cluster.urls.zeebeRest,
41
+ operateUrl: cluster.urls.operate,
42
+ tasklistUrl: cluster.urls.tasklist,
43
+ optimizeUrl: cluster.urls.optimize,
44
+ connectorsUrl: cluster.urls.connectors,
45
+ identityUrl: cluster.urls.identity,
46
+ accountId: cluster.encryptionAccountId,
47
+ conditions: cluster.conditions,
48
+ updateClusterStatus: update && {
49
+ updateState: update.state,
50
+ currentGeneration: toGeneration(update.currentGeneration),
51
+ previousGeneration: toGeneration(update.previousGeneration),
52
+ lastUpdatedTime: update.lastUpdatedAt,
53
+ },
54
+ },
55
+ // The internal list sends these objects with the same few fields.
56
+ generation: {
57
+ uuid: cluster.generation.id,
58
+ name: cluster.generation.name,
59
+ versions: cluster.generation.versions,
60
+ isUnsupportedStarting: cluster.generation.unsupportedStarting,
61
+ },
62
+ k8sContext: {
63
+ uuid: cluster.region.id,
64
+ name: cluster.region.name,
65
+ provider: cluster.region.provider,
66
+ },
67
+ k8sContextUuid: cluster.region.id,
68
+ planType: {
69
+ uuid: cluster.planType.id,
70
+ name: cluster.planType.name,
71
+ development: cluster.planType.development,
72
+ category: cluster.planType.category,
73
+ availabilityClass: cluster.planType.availabilityClass,
74
+ },
75
+ labels: {
76
+ // The backend only stores the allowed stage labels.
77
+ camunda: (cluster.labels?.camunda ?? []),
78
+ custom: cluster.labels?.custom ?? [],
79
+ },
80
+ autoUpdate: cluster.autoUpdate,
81
+ rba: cluster.rba,
82
+ identityBackendChecksEnabled: cluster.identityBackendChecksEnabled,
83
+ enforceGroups: cluster.enforceGroups,
84
+ playMode: cluster.playMode,
85
+ mcpEnabled: cluster.mcpEnabled,
86
+ businessIdUniquenessEnabled: cluster.businessIdUniquenessEnabled,
87
+ multiTenancyEnabled: cluster.multiTenancyEnabled,
88
+ sessionMaxInactiveIntervalMinutes: cluster.sessionMaxInactiveIntervalMinutes,
89
+ sessionHeartbeatEnabled: cluster.sessionHeartbeatEnabled,
90
+ externalIdpEnabled: cluster.externalIdpEnabled,
91
+ externalIdpConfig: cluster.externalIdpConfig,
92
+ numberOfAllocatedHwPackages: cluster.numberOfAllocatedHwPackages,
93
+ encryption: cluster.encryption,
94
+ primaryEncryptionKeyId: cluster.primaryEncryptionKeyId,
95
+ secondaryEncryptionKeyId: cluster.secondaryEncryptionKeyId,
96
+ externalMetadata: {
97
+ swagger: cluster.swagger,
98
+ appIntegrationsEnabled: cluster.appIntegrationsEnabled,
99
+ optimizeEnabled: cluster.optimizeEnabled,
100
+ optimizeFiltering: cluster.optimizeFiltering,
101
+ secretsFilterMode: cluster.secretsFilterMode,
102
+ tasklistV2Enabled: cluster.tasklistV2Enabled,
103
+ auditLog: {
104
+ enabled: cluster.auditLogEnabled,
105
+ userCategories: cluster.auditLogUserCategories,
106
+ clientCategories: cluster.auditLogClientCategories,
107
+ },
108
+ },
109
+ // Always set, so that a merge into the cache clears an old pause.
110
+ spec: { reconciliation: { paused: cluster.maintenance === true } },
111
+ restoreInProgress: cluster.status === 'restoring',
112
+ restoreFailed: fromList ? undefined : cluster.restoreFailedId !== undefined,
113
+ failedRestoreId: cluster.restoreFailedId,
114
+ backupRegionId: cluster.backup?.regionId,
115
+ backupRegion: cluster.backup?.region,
116
+ backupRegionCodes: cluster.backup?.regionCodes,
117
+ backupFailoverSupported: cluster.backup?.failoverSupported,
118
+ secondaryBucketSyncCompleted: cluster.backup?.secondarySyncCompleted,
119
+ isFailoverSource: cluster.failover?.isSource,
120
+ failoverSourceClusterId: cluster.failover?.sourceClusterId,
121
+ stableId: cluster.failover?.stableId,
122
+ ttl: cluster.ttl,
123
+ hasOptimize: cluster.optimizeAvailable,
124
+ ipWhitelist: cluster.ipAllowlist?.map((entry) => ({
125
+ ip: entry.ip,
126
+ description: entry.description ?? '',
127
+ })),
128
+ };
129
+ };
130
+ /**
131
+ * Maps the `/cli/v1` create parameters to the shape of the internal route.
132
+ * The CLI marks the defaults itself, and `default` takes the place of
133
+ * `isDefault` and `defaultGeneration`.
134
+ */
135
+ export const toCreationParameters = (parameters) => ({
136
+ regions: parameters.regions.map((region) => ({
137
+ uuid: region.id,
138
+ name: region.name,
139
+ provider: region.provider,
140
+ backups: region.backups?.map((backup) => ({
141
+ uuid: backup.id,
142
+ failover: backup.failover,
143
+ regions: backup.regions.map((value) => ({
144
+ id: value.id,
145
+ label: value.name,
146
+ })),
147
+ })),
148
+ })),
149
+ channels: parameters.channels.map((channel) => ({
150
+ uuid: channel.id,
151
+ name: channel.name,
152
+ description: channel.description,
153
+ isDefault: channel.default,
154
+ defaultGeneration: {
155
+ uuid: channel.generations.find((generation) => generation.default)?.id,
156
+ },
157
+ allowedGenerations: channel.generations.map((generation) => ({
158
+ uuid: generation.id,
159
+ name: generation.name,
160
+ classification: generation.classification,
161
+ versions: generation.versions,
162
+ })),
163
+ })),
164
+ clusterPlanTypes: parameters.planTypes.map((planType) => ({
165
+ uuid: planType.id,
166
+ name: planType.name,
167
+ description: planType.description,
168
+ development: planType.development,
169
+ category: planType.category,
170
+ availabilityClass: planType.availabilityClass,
171
+ })),
172
+ unlockedClusterPlans: parameters.clusterPlans?.map((plan) => ({
173
+ uuid: plan.id,
174
+ name: plan.name,
175
+ })),
176
+ clusterTtlEnabled: parameters.ttlEnabled,
177
+ });
178
+ /**
179
+ * The cluster reads. They go to the `/cli/v1` routes when `cliApi` is on,
180
+ * else to the internal routes. Both give the shapes of the internal routes.
181
+ * Part of #11623: delete it with the flag.
182
+ */
183
+ export const cliClusterReadsApi = (cliApi) => ({
184
+ getClusters: async (request) => {
185
+ if (!cliApi) {
186
+ const response = await ConsoleClusterService.getClusters(request);
187
+ // Old responses wrap the list in `clusters`.
188
+ if (Array.isArray(response)) {
189
+ return response;
190
+ }
191
+ const wrapped = response?.clusters;
192
+ return Array.isArray(wrapped) ? wrapped : [];
193
+ }
194
+ const clusters = await ConsoleCliClusterService.getClusters(request);
195
+ return clusters.map((cluster) => toC4Cluster(request.params.orgId, cluster, true));
196
+ },
197
+ getCluster: async (request) => cliApi
198
+ ? toC4Cluster(request.params.orgId, await ConsoleCliClusterService.getCluster(request))
199
+ : ConsoleClusterService.getCluster(request),
200
+ getCreationParameters: async (request) => cliApi
201
+ ? toCreationParameters(await ConsoleCliClusterService.getClusterParameters(request))
202
+ : ConsoleClusterParametersService.getCreationParameters(request),
203
+ });
204
+ export const useCliClusterReadsApi = () => {
205
+ const cliApi = useConsoleCliApi();
206
+ return useMemo(() => cliClusterReadsApi(cliApi), [cliApi]);
207
+ };
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { AuditLoggerService, ConsoleClusterParametersService, ConsoleClusterService, GenerationService, HdpService, HttpError, SaaSJobsService, } from '@camunda/ccma-api';
7
+ import { AuditLoggerService, GenerationService, HdpService, HttpError, SaaSJobsService, } from '@camunda/ccma-api';
8
8
  import { AUDIT_LOG_TAB_MIN_VERSION, CLUSTER_STATISTICS_CONFIG_MIN_VERSION, checkVersion, deriveEncryptionKeyStatus, deriveEncryptionStatus, deriveSecondaryStorageStatus, needsKeyOwnerAction, SalesPlanType, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
9
9
  import { observer } from 'mobx-react-lite';
10
10
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
@@ -20,8 +20,10 @@ import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migratio
20
20
  import { toApiConfig } from '../../runtime/to-api-config.js';
21
21
  import { useCliActionsApi } from '../../runtime/use-cli-actions-api.js';
22
22
  import { useCliClusterApi } from '../../runtime/use-cli-cluster-api.js';
23
+ import { useCliClusterReadsApi } from '../../runtime/use-cli-cluster-reads-api.js';
23
24
  import { useCliExtrasApi } from '../../runtime/use-cli-extras-api.js';
24
25
  import { useCliResourcesApi } from '../../runtime/use-cli-resources-api.js';
26
+ import { useConsoleCliApi } from '../../runtime/use-console-cli-api.js';
25
27
  import { Modal, Stack, TextInput } from '../../ui/index.js';
26
28
  import { isMigrationLocked, } from '../../utils/migration-view.js';
27
29
  import { buildBackupChoiceUpdate, buildReopenTransferUpdate, buildTransferFinishedUpdate, getMigrationView, isMigrationPlan, MIGRATION_NAME_MAX_LENGTH, } from '../../utils/migration-workaround.js';
@@ -311,6 +313,7 @@ export const C4ClusterDetailsApp = observer((props) => {
311
313
  const runtime = useC4ConsoleRuntime();
312
314
  const clusterActions = useCliActionsApi();
313
315
  const clusterApi = useCliClusterApi();
316
+ const clusterReads = useCliClusterReadsApi();
314
317
  const cliExtras = useCliExtrasApi();
315
318
  const clusterCreationBlocked = useC4FeatureFlag(CLUSTER_CREATION_BLOCKED_FLAG);
316
319
  const upgradeReadinessGateEnabled = useC4FeatureFlag('console.upgradeReadinessGate');
@@ -389,19 +392,32 @@ export const C4ClusterDetailsApp = observer((props) => {
389
392
  setActiveTabId(props.desiredTabId);
390
393
  }
391
394
  }, [props.desiredTabId]);
395
+ // A newer reload replaces an older one that is still pending (for example
396
+ // when the CLI flag turns on). Only the newest call writes its result.
397
+ const clusterRequestRef = useRef(0);
398
+ const creationParametersRequestRef = useRef(0);
399
+ const alertsRequestRef = useRef(0);
400
+ const byomRequestRef = useRef(0);
392
401
  const reloadCluster = useCallback(async () => {
402
+ const request = ++clusterRequestRef.current;
393
403
  setIsClusterLoading(true);
394
404
  setClusterError('');
395
405
  try {
396
- const loaded = await ConsoleClusterService.getCluster({
406
+ const loaded = await clusterReads.getCluster({
397
407
  config: apiConfig,
398
408
  params: { orgId: props.orgId, clusterId: props.clusterId },
399
409
  });
410
+ if (request !== clusterRequestRef.current) {
411
+ return;
412
+ }
400
413
  skipNextSseMergeRef.current = true;
401
414
  setCluster(loaded);
402
415
  data.upsertCluster(props.orgId, loaded);
403
416
  }
404
417
  catch (error) {
418
+ if (request !== clusterRequestRef.current) {
419
+ return;
420
+ }
405
421
  // A cluster that no longer exists (e.g. a stale/typo'd URL) is not an
406
422
  // error state worth rendering inline — send the user back to the
407
423
  // dashboard instead of showing an empty tab shell with the backend's
@@ -418,25 +434,41 @@ export const C4ClusterDetailsApp = observer((props) => {
418
434
  setClusterError(error instanceof Error ? error.message : 'Failed to load');
419
435
  }
420
436
  finally {
421
- setIsClusterLoading(false);
437
+ if (request === clusterRequestRef.current) {
438
+ setIsClusterLoading(false);
439
+ }
422
440
  }
423
- }, [apiConfig, data, props.clusterId, props.onNavigate, props.orgId]);
441
+ }, [
442
+ apiConfig,
443
+ clusterReads,
444
+ data,
445
+ props.clusterId,
446
+ props.onNavigate,
447
+ props.orgId,
448
+ ]);
424
449
  const reloadCreationParameters = useCallback(async () => {
450
+ const request = ++creationParametersRequestRef.current;
425
451
  setIsCreationParametersLoading(true);
426
452
  try {
427
- const loaded = await ConsoleClusterParametersService.getCreationParameters({
453
+ const loaded = await clusterReads.getCreationParameters({
428
454
  config: apiConfig,
429
455
  params: { orgId: props.orgId },
430
456
  });
431
- setCreationParameters(loaded);
457
+ if (request === creationParametersRequestRef.current) {
458
+ setCreationParameters(loaded);
459
+ }
432
460
  }
433
461
  catch {
434
- setCreationParameters(undefined);
462
+ if (request === creationParametersRequestRef.current) {
463
+ setCreationParameters(undefined);
464
+ }
435
465
  }
436
466
  finally {
437
- setIsCreationParametersLoading(false);
467
+ if (request === creationParametersRequestRef.current) {
468
+ setIsCreationParametersLoading(false);
469
+ }
438
470
  }
439
- }, [apiConfig, props.orgId]);
471
+ }, [apiConfig, clusterReads, props.orgId]);
440
472
  const canSeeClusterLoad = Boolean(authz.visibilities.clusters?.canSeeClusterLoad);
441
473
  // After a manual reload, skip the immediately-following SSE merge. A stale
442
474
  // SSE event that arrives during the PATCH+reload cycle can overwrite the
@@ -776,11 +808,13 @@ export const C4ClusterDetailsApp = observer((props) => {
776
808
  }, []);
777
809
  const reloadAlerts = useCallback(async () => {
778
810
  if (!canViewAlertsTab) {
811
+ alertsRequestRef.current++;
779
812
  setAlerts([]);
780
813
  alertsLoadedRef.current = true;
781
814
  setAlertsLoading(false);
782
815
  return;
783
816
  }
817
+ const request = ++alertsRequestRef.current;
784
818
  setAlertsLoading(true);
785
819
  try {
786
820
  const [loaded] = await Promise.all([
@@ -791,6 +825,9 @@ export const C4ClusterDetailsApp = observer((props) => {
791
825
  data.fetchMembers(props.orgId),
792
826
  ]);
793
827
  const members = data.getMembers(props.orgId) ?? [];
828
+ if (request !== alertsRequestRef.current) {
829
+ return;
830
+ }
794
831
  setAlerts(loaded.map((a) => {
795
832
  const alert = a;
796
833
  const resolvedTarget = a.report === 'Webhook'
@@ -816,8 +853,10 @@ export const C4ClusterDetailsApp = observer((props) => {
816
853
  }));
817
854
  }
818
855
  finally {
819
- alertsLoadedRef.current = true;
820
- setAlertsLoading(false);
856
+ if (request === alertsRequestRef.current) {
857
+ alertsLoadedRef.current = true;
858
+ setAlertsLoading(false);
859
+ }
821
860
  }
822
861
  }, [
823
862
  apiConfig,
@@ -1011,6 +1050,7 @@ export const C4ClusterDetailsApp = observer((props) => {
1011
1050
  ]);
1012
1051
  const reloadByom = useCallback(async () => {
1013
1052
  if (!canViewMonitoringTab) {
1053
+ byomRequestRef.current++;
1014
1054
  setByomClients([]);
1015
1055
  setByomStatus({});
1016
1056
  setByomError(false);
@@ -1018,6 +1058,7 @@ export const C4ClusterDetailsApp = observer((props) => {
1018
1058
  setByomLoading(false);
1019
1059
  return;
1020
1060
  }
1061
+ const request = ++byomRequestRef.current;
1021
1062
  setByomLoading(true);
1022
1063
  setByomError(false);
1023
1064
  try {
@@ -1025,6 +1066,9 @@ export const C4ClusterDetailsApp = observer((props) => {
1025
1066
  config: apiConfig,
1026
1067
  params: { orgId: props.orgId, clusterId: props.clusterId },
1027
1068
  });
1069
+ if (request !== byomRequestRef.current) {
1070
+ return;
1071
+ }
1028
1072
  setByomStatus(response.status ?? {});
1029
1073
  setByomClients((response.clients ?? []).map((client) => ({
1030
1074
  id: client.uuid,
@@ -1035,13 +1079,18 @@ export const C4ClusterDetailsApp = observer((props) => {
1035
1079
  })));
1036
1080
  }
1037
1081
  catch {
1082
+ if (request !== byomRequestRef.current) {
1083
+ return;
1084
+ }
1038
1085
  setByomError(true);
1039
1086
  setByomClients([]);
1040
1087
  setByomStatus({});
1041
1088
  }
1042
1089
  finally {
1043
- byomLoadedRef.current = true;
1044
- setByomLoading(false);
1090
+ if (request === byomRequestRef.current) {
1091
+ byomLoadedRef.current = true;
1092
+ setByomLoading(false);
1093
+ }
1045
1094
  }
1046
1095
  }, [
1047
1096
  apiConfig,
@@ -1079,7 +1128,10 @@ export const C4ClusterDetailsApp = observer((props) => {
1079
1128
  // -----------------------------
1080
1129
  // Initial load: load all tab data once per org/cluster
1081
1130
  // -----------------------------
1082
- const initialLoadKey = `${props.orgId}:${props.clusterId}`;
1131
+ // On a hard load the flag answer comes after authz. The key holds the flag
1132
+ // so the load runs again with the right services when it changes.
1133
+ const cliApiOn = useConsoleCliApi();
1134
+ const initialLoadKey = `${props.orgId}:${props.clusterId}:${cliApiOn}`;
1083
1135
  const lastInitialLoadKeyRef = useRef(undefined);
1084
1136
  useEffect(() => {
1085
1137
  // Wait for authz to resolve so tab visibility is stable.
@@ -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 { ConsoleClusterParametersService, ConsoleClusterService, OrgsService, } from '@camunda/ccma-api';
7
+ import { OrgsService } from '@camunda/ccma-api';
8
8
  import { CLUSTER_TTL_OPTIONS, CLUSTER_TTL_UNLIMITED_LINK_MAX_LENGTH, CLUSTER_TTL_UNLIMITED_REASON_MAX_LENGTH, ClusterEncryptionKey, DEFAULT_CLUSTER_TTL_OPTION, getDisplayedSalesPlan, isHttpUrl, MAX_HARDWARE_PACKAGE_COUNT, MAX_LENGTH_CLUSTER_NAME, SalesPlanType, sortByAvailabilityClasses, sortGenerationBySemverOfZeebe, } from '@camunda/ccma-shared-types';
9
9
  import { observer } from 'mobx-react-lite';
10
10
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -18,6 +18,7 @@ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console
18
18
  import { SELF_MANAGED_MIGRATION_FLAG } from '../../runtime/self-managed-migration.js';
19
19
  import { toApiConfig } from '../../runtime/to-api-config.js';
20
20
  import { useCliActionsApi } from '../../runtime/use-cli-actions-api.js';
21
+ import { useCliClusterReadsApi } from '../../runtime/use-cli-cluster-reads-api.js';
21
22
  import { Link, Stack } from '../../ui/index.js';
22
23
  import { buildMigrationCreateName, isValidAwsRoleArn, MIGRATION_NAME_MAX_LENGTH, MIGRATION_ROLE_ARN_MAX_LENGTH, } from '../../utils/migration-workaround.js';
23
24
  import { safeTranslate } from '../../utils/safe-translate.js';
@@ -408,6 +409,7 @@ export function buildCreateClusterTranslations(t) {
408
409
  export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkToAnExpertUrl, externalLinks, onNavigate, duplicateOfClusterId: sourceClusterId, }) => {
409
410
  const runtime = useC4ConsoleRuntime();
410
411
  const clusterActions = useCliActionsApi();
412
+ const clusterReads = useCliClusterReadsApi();
411
413
  const data = useC4ConsoleData();
412
414
  const authz = useC4ConsoleAuthz({ orgId });
413
415
  const resolvedTalkToAnExpertUrl = useMemo(() => talkToAnExpertUrl ??
@@ -451,7 +453,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
451
453
  setSourceClusterLoading(Boolean(sourceClusterId));
452
454
  try {
453
455
  const [parametersResponse, orgResponse, sourceClusterResponse] = await Promise.all([
454
- ConsoleClusterParametersService.getCreationParameters({
456
+ clusterReads.getCreationParameters({
455
457
  params: { orgId },
456
458
  config: apiConfig,
457
459
  }),
@@ -460,7 +462,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
460
462
  config: apiConfig,
461
463
  }),
462
464
  sourceClusterId
463
- ? ConsoleClusterService.getCluster({
465
+ ? clusterReads.getCluster({
464
466
  params: { orgId, clusterId: sourceClusterId },
465
467
  config: apiConfig,
466
468
  })
@@ -496,7 +498,7 @@ export const C4CreateClusterPage = observer(({ orgId, afterCreateModalUrl, talkT
496
498
  return () => {
497
499
  cancelled = true;
498
500
  };
499
- }, [orgId, apiConfig, runtime.telemetry, sourceClusterId]);
501
+ }, [orgId, apiConfig, clusterReads, runtime.telemetry, sourceClusterId]);
500
502
  const clustersCache = data.clusters[orgId];
501
503
  const rawClusters = (clustersCache?.data ?? []);
502
504
  const clustersLoading = clustersCache?.isLoading ?? false;
@@ -3,7 +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 { useCallback, useState } from 'react';
6
+ import { useCallback, useRef, useState } from 'react';
7
7
  import { useCliResourcesApi } from '../../runtime/use-cli-resources-api.js';
8
8
  /**
9
9
  * The cluster's API clients, with the load/error/reload state the clients panel
@@ -23,12 +23,19 @@ export function useClusterApiClients(params) {
23
23
  const [clients, setClients] = useState([]);
24
24
  const [loading, setLoading] = useState(false);
25
25
  const [error, setError] = useState(false);
26
+ // A newer reload replaces an older one that is still pending. Only the
27
+ // newest call writes its result.
28
+ const requestRef = useRef(0);
26
29
  const reload = useCallback(async () => {
27
30
  if (!enabled) {
31
+ // Drop a request that is still pending.
32
+ requestRef.current++;
28
33
  setClients([]);
29
34
  setError(false);
35
+ setLoading(false);
30
36
  return;
31
37
  }
38
+ const request = ++requestRef.current;
32
39
  setLoading(true);
33
40
  setError(false);
34
41
  try {
@@ -36,13 +43,19 @@ export function useClusterApiClients(params) {
36
43
  config: apiConfig,
37
44
  params: { orgId, clusterId },
38
45
  });
39
- setClients(loaded);
46
+ if (request === requestRef.current) {
47
+ setClients(loaded);
48
+ }
40
49
  }
41
50
  catch {
42
- setError(true);
51
+ if (request === requestRef.current) {
52
+ setError(true);
53
+ }
43
54
  }
44
55
  finally {
45
- setLoading(false);
56
+ if (request === requestRef.current) {
57
+ setLoading(false);
58
+ }
46
59
  }
47
60
  }, [apiConfig, clusterId, enabled, orgId, resourcesApi]);
48
61
  return { clients, loading, error, reload };
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  */
7
7
  import { C4GroupsList, C4IdentityContextProvider } from '@camunda/c4-identity';
8
8
  import { useC3Profile } from '@camunda/camunda-composite-components';
9
- import { AuditLoggerService, ConsoleClusterParametersService, EarlyAccessFeaturesService, HdpService, HttpError, OrganizationMembersService, OrgsService, UsageAlertsService, } from '@camunda/ccma-api';
9
+ import { AuditLoggerService, EarlyAccessFeaturesService, HdpService, HttpError, OrganizationMembersService, OrgsService, UsageAlertsService, } from '@camunda/ccma-api';
10
10
  import { ACTIVITY_RETENTION_CHOICES, ACTIVITY_RETENTION_FLAG, activityRetentionLabel, addMonthsClamped, checkVersion, diffInWholeMonths, getCurrentEnterpriseTerm, getDisplayedSalesPlan, getRevisitedSalesPlanName, IDENTITY_MANAGEMENT_MIN_VERSION, isActivityRetentionMonths, isLimitedActivityRetention, NEW_CLUSTER_ROLES_MIN_VERSION, OrganizationRole, peakWithinTerm, SseEntity, toUtcDayStartMs, USAGE_SALES_PLAN_TYPES, VersionCheckOperator, } from '@camunda/ccma-shared-types';
11
11
  import { observer } from 'mobx-react-lite';
12
12
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
@@ -20,6 +20,7 @@ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console
20
20
  import { ORG_CLUSTER_DEFAULTS_FLAG } from '../../runtime/org-cluster-defaults.js';
21
21
  import { toApiConfig } from '../../runtime/to-api-config.js';
22
22
  import { toIdentityApiBaseUrl } from '../../runtime/to-identity-api-base-url.js';
23
+ import { useCliClusterReadsApi } from '../../runtime/use-cli-cluster-reads-api.js';
23
24
  import { useCliExtrasApi } from '../../runtime/use-cli-extras-api.js';
24
25
  import { useCliOrgApi } from '../../runtime/use-cli-org-api.js';
25
26
  import { useHubApiNaming } from '../../runtime/use-hub-api-naming.js';
@@ -567,6 +568,7 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
567
568
  const data = useC4ConsoleData();
568
569
  const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
569
570
  const orgApi = useCliOrgApi();
571
+ const clusterReads = useCliClusterReadsApi();
570
572
  const fetchMembers = data.fetchMembers;
571
573
  const fetchClusters = data.fetchClusters;
572
574
  const fetchOrgInfo = data.fetchOrgInfo;
@@ -1303,7 +1305,8 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
1303
1305
  // billing figure on the page — hostage. Because it is in flight before the
1304
1306
  // cluster fetch even starts, it normally lands well before the numbers do
1305
1307
  // and the table never renders a placeholder name.
1306
- void ConsoleClusterParametersService.getCreationParameters({
1308
+ void clusterReads
1309
+ .getCreationParameters({
1307
1310
  config: apiConfig,
1308
1311
  params: { orgId },
1309
1312
  })
@@ -1388,7 +1391,7 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
1388
1391
  finally {
1389
1392
  setBillingLoading(false);
1390
1393
  }
1391
- }, [apiConfig, cliExtras, orgId, isLicensingModel2025]);
1394
+ }, [apiConfig, cliExtras, clusterReads, orgId, isLicensingModel2025]);
1392
1395
  const enterpriseDevOnly = useMemo(() => getNestedBoolean(org, ['metadata', 'enterpriseDevOnly']), [org]);
1393
1396
  const billingIsEnterprise = useMemo(() => orgHasSalesPlanType(org, 'enterprise'), [org]);
1394
1397
  const billingGeneralData = useMemo(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.35.6",
3
+ "version": "0.35.8",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -85,7 +85,7 @@
85
85
  "react-markdown": "^8.0.7 || ^10.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@camunda/ccma-api": "12.2.0",
88
+ "@camunda/ccma-api": "12.2.1",
89
89
  "@camunda/ccma-shared-types": "18.1.0",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",