@camunda/ccma-saas-frontend 0.35.2 → 0.35.4

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.
@@ -214,7 +214,7 @@ export { openC4CreateConsoleApiClientModal, setC4CreateConsoleApiClientModalHand
214
214
  export { openC4InviteUserToOrganizationModal, setC4InviteUserToOrganizationModalHandle, } from './modals/c4-invite-user-to-organization-modal-handle.js';
215
215
  export { openC4RenameOrganizationModal, setC4RenameOrganizationModalHandle, } from './modals/c4-rename-organization-modal-handle.js';
216
216
  export type { AccountsPermissions, AddC4ConsoleNotificationOptions, C4BreadcrumbCrumb, C4BreadcrumbDropdownItem, C4ClusterNavAppEntry, C4ClusterNavEntry, C4ConsoleAuthzFeatures, C4ConsoleAuthzState, C4ConsoleDataState, C4ConsoleEventsProviderProps, C4ConsoleNotification, C4ConsoleNotificationAction, C4ConsoleNotificationKind, C4ConsoleNotificationsState, C4ConsoleRuntimeConfig, C4ConsoleVisibilities, C4ResolvedTheme, C4ThemePreference, C4UserNotificationsProviderProps, C4UserNotificationsState, C4UserThemeState, CacheState, CamundaWebApp, ConsoleAuth, ConsoleBackendUrls, ConsoleClickwrapConfig, ConsoleClusterDto, ConsolePermissions, ConsolePublicUrls, ConsoleStage, ConsoleTelemetry, ConsoleUser, ExternalClusterDto, ExternalOrganizationDto, NotificationDto, OrganizationPermissions, OrganizationRole, OrgCache, SseEntity, UpgradableGenerationsDto, UseC4ClusterNavEntriesOptions, UseC4WebappBreadcrumbDataOptions, } from './runtime/index.js';
217
- export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, } from './runtime/index.js';
217
+ export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, CONSOLE_CLI_API_FLAG, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, useConsoleCliApi, } from './runtime/index.js';
218
218
  export type { MigrationAccess, MigrationAccessStatement, MigrationBackupChoice, MigrationDetectedBackup, MigrationPhase, MigrationReason, MigrationReasonParams, MigrationSourceAccess, MigrationSourceInput, MigrationSourceKind, MigrationSpec, MigrationView, } from './utils/migration-view.js';
219
219
  export type { TranslateFn } from './utils/safe-translate.js';
220
220
  export { ENVIRONMENT_KEY_SUFFIX, safeTranslate, scopedTranslate, } from './utils/safe-translate.js';
package/lib/esm/index.js CHANGED
@@ -123,7 +123,7 @@ export { openC4RenameOrganizationModal, setC4RenameOrganizationModalHandle, } fr
123
123
  // re-listed per module, so the package root and the
124
124
  // `@camunda/ccma-saas-frontend/runtime` subpath expose one identical surface.
125
125
  // Add runtime exports in `src/runtime/index.ts` and mirror them here.
126
- export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, } from './runtime/index.js';
126
+ export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, CONSOLE_CLI_API_FLAG, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4FeatureFlag, useC4TwoPhaseUpgradeMockup, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, useConsoleCliApi, } from './runtime/index.js';
127
127
  export { ENVIRONMENT_KEY_SUFFIX, safeTranslate, scopedTranslate, } from './utils/safe-translate.js';
128
128
  export { C4ClusterClientDetailsApp } from './widgets/cluster-client-details/c4-cluster-client-details-app.js';
129
129
  export { C4ClusterDetailsApp } from './widgets/cluster-details/c4-cluster-details-app.js';
@@ -41,3 +41,4 @@ export { buildModelerOrgUrl, DEFAULT_NAV_APPS, getClusterStage, getEndpointForAp
41
41
  export type { C4BreadcrumbCrumb, C4BreadcrumbDropdownItem, C4ClusterNavAppEntry, C4ClusterNavEntry, UseC4ClusterNavEntriesOptions, UseC4WebappBreadcrumbDataOptions, } from './nav/use-webapp-nav-data.js';
42
42
  export { useC4ClusterNavEntries, useC4WebappBreadcrumbData, } from './nav/use-webapp-nav-data.js';
43
43
  export { useC4TwoPhaseUpgradeMockup } from './use-c4-two-phase-upgrade-mockup.js';
44
+ export { CONSOLE_CLI_API_FLAG, useConsoleCliApi } from './use-console-cli-api.js';
@@ -19,3 +19,4 @@ export { useC4UserTheme } from './c4-user-theme.js';
19
19
  export { buildModelerOrgUrl, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, resolveAdminAppName, } from './nav/camunda-apps.js';
20
20
  export { useC4ClusterNavEntries, useC4WebappBreadcrumbData, } from './nav/use-webapp-nav-data.js';
21
21
  export { useC4TwoPhaseUpgradeMockup } from './use-c4-two-phase-upgrade-mockup.js';
22
+ export { CONSOLE_CLI_API_FLAG, useConsoleCliApi } from './use-console-cli-api.js';
@@ -0,0 +1,24 @@
1
+ import type { RequestBaseParamsConfig } from '@camunda/ccma-api';
2
+ import type { BackupScheduleDto } from '@camunda/ccma-shared-types';
3
+ interface ClusterRequest {
4
+ config: RequestBaseParamsConfig;
5
+ params: {
6
+ orgId: string;
7
+ clusterId: string;
8
+ };
9
+ }
10
+ export interface IpAllowlistEntry {
11
+ ip: string;
12
+ description: string;
13
+ }
14
+ /**
15
+ * The backup schedule and IP allowlist calls of a cluster. They go to the
16
+ * `/cli/v1` routes while `useConsoleCliApi` is on, else to the internal
17
+ * routes. Part of the pilot of #11623: delete it with the flag.
18
+ */
19
+ export declare const useCliPilotApi: () => {
20
+ getBackupSchedule: (request: ClusterRequest) => Promise<BackupScheduleDto | undefined>;
21
+ setBackupSchedule: (request: ClusterRequest, schedule: string | undefined) => Promise<void>;
22
+ setIpAllowlist: (request: ClusterRequest, entries: IpAllowlistEntry[]) => Promise<void>;
23
+ };
24
+ export {};
@@ -0,0 +1,53 @@
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 { ConsoleBackupScheduleService, ConsoleCliService, ConsoleIpWhitelistService, } from '@camunda/ccma-api';
7
+ import { useMemo } from 'react';
8
+ import { useConsoleCliApi } from './use-console-cli-api.js';
9
+ /**
10
+ * The backup schedule and IP allowlist calls of a cluster. They go to the
11
+ * `/cli/v1` routes while `useConsoleCliApi` is on, else to the internal
12
+ * routes. Part of the pilot of #11623: delete it with the flag.
13
+ */
14
+ export const useCliPilotApi = () => {
15
+ const cliApi = useConsoleCliApi();
16
+ return useMemo(() => ({
17
+ getBackupSchedule: async (request) => {
18
+ if (!cliApi) {
19
+ return (await ConsoleBackupScheduleService.getBackupSchedule(request))[0];
20
+ }
21
+ const { schedule } = await ConsoleCliService.getBackupSchedule(request);
22
+ return schedule
23
+ ? { name: request.params.clusterId, schedule }
24
+ : undefined;
25
+ },
26
+ // `undefined` removes the schedule.
27
+ setBackupSchedule: async (request, schedule) => {
28
+ if (cliApi) {
29
+ await ConsoleCliService.setBackupSchedule({
30
+ ...request,
31
+ body: { schedule },
32
+ });
33
+ }
34
+ else {
35
+ await ConsoleBackupScheduleService.updateBackupSchedule({
36
+ ...request,
37
+ body: { schedule },
38
+ });
39
+ }
40
+ },
41
+ setIpAllowlist: async (request, entries) => {
42
+ if (cliApi) {
43
+ await ConsoleCliService.setIpAllowlist({
44
+ ...request,
45
+ body: { entries },
46
+ });
47
+ }
48
+ else {
49
+ await ConsoleIpWhitelistService.update({ ...request, body: entries });
50
+ }
51
+ },
52
+ }), [cliApi]);
53
+ };
@@ -0,0 +1,15 @@
1
+ export declare const CONSOLE_CLI_API_FLAG = "console.c4CliApi";
2
+ export declare const CLI_API_GATE_FLAG = "shared.cliApi";
3
+ /**
4
+ * Whether c4 calls the `/cli/v1` routes of console-backend (the customer API
5
+ * of c8cloud) in place of the internal `/api/orgs/...` routes. A pilot of
6
+ * #11623: only the backup schedule and the IP allowlist move.
7
+ *
8
+ * Both flags must be on. The routes answer 404 while `shared.cliApi` is off.
9
+ * The backend reads that flag with no user, but c4 reads it for the user and
10
+ * the org. So `shared.cliApi` must be enabled for all (no org or email list)
11
+ * while the pilot runs: else c4 can send calls that get a 404. When the move
12
+ * is done or stopped, delete this hook, the branch at each call site and
13
+ * the flag rows.
14
+ */
15
+ export declare const useConsoleCliApi: () => boolean;
@@ -0,0 +1,25 @@
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 { useC4FeatureFlag } from './c4-console-runtime-context.js';
7
+ export const CONSOLE_CLI_API_FLAG = 'console.c4CliApi';
8
+ export const CLI_API_GATE_FLAG = 'shared.cliApi';
9
+ /**
10
+ * Whether c4 calls the `/cli/v1` routes of console-backend (the customer API
11
+ * of c8cloud) in place of the internal `/api/orgs/...` routes. A pilot of
12
+ * #11623: only the backup schedule and the IP allowlist move.
13
+ *
14
+ * Both flags must be on. The routes answer 404 while `shared.cliApi` is off.
15
+ * The backend reads that flag with no user, but c4 reads it for the user and
16
+ * the org. So `shared.cliApi` must be enabled for all (no org or email list)
17
+ * while the pilot runs: else c4 can send calls that get a 404. When the move
18
+ * is done or stopped, delete this hook, the branch at each call site and
19
+ * the flag rows.
20
+ */
21
+ export const useConsoleCliApi = () => {
22
+ const pilotOn = useC4FeatureFlag(CONSOLE_CLI_API_FLAG);
23
+ const gateOn = useC4FeatureFlag(CLI_API_GATE_FLAG);
24
+ return pilotOn && gateOn;
25
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { ConsoleBackupScheduleService, ConsoleHotBackupsService, } from '@camunda/ccma-api';
2
+ import { ConsoleHotBackupsService } from '@camunda/ccma-api';
3
3
  import { BackupStatus, checkVersion, HOT_BACKUP_MIN_VERSION, HOTBACKUP_MIN_CREATE_PERIOD, SseEntity, VersionCheckOperator, } from '@camunda/ccma-shared-types';
4
4
  import { CronExpression, CronExpressionParser, CronFieldCollection, } from 'cron-parser';
5
5
  import { observer } from 'mobx-react-lite';
@@ -9,6 +9,7 @@ import { C4ClusterDetailsHotBackupsRestore } from '../../../components/c4-cluste
9
9
  import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
10
10
  import { useC4ConsoleNotifications } from '../../../runtime/c4-console-notifications-context.js';
11
11
  import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
12
+ import { useCliPilotApi } from '../../../runtime/use-cli-pilot-api.js';
12
13
  import { Checkbox, Link, Modal, Stack, TextInput } from '../../../ui/index.js';
13
14
  import { Select, SelectItem } from '../../../ui/families.js';
14
15
  import { safeTranslate } from '../../../utils/safe-translate.js';
@@ -207,6 +208,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
207
208
  }, [trackEvent]);
208
209
  // Main state
209
210
  const [hotBackups, setHotBackups] = useState([]);
211
+ const cliApi = useCliPilotApi();
210
212
  const [backupSchedule, setBackupSchedule] = useState(undefined);
211
213
  const [hotBackupsLoading, setHotBackupsLoading] = useState(false);
212
214
  const [hotBackupsError, setHotBackupsError] = useState(false);
@@ -238,6 +240,9 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
238
240
  if (!isHotBackupEnabled) {
239
241
  return;
240
242
  }
243
+ // A load runs: skip. If the CLI pilot flag flips during the first load,
244
+ // the result of the internal route stays until the next SSE event or
245
+ // refresh. It shows the same schedule, so the pilot accepts this.
241
246
  if (hotBackupsLoadingRef.current) {
242
247
  return;
243
248
  }
@@ -255,7 +260,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
255
260
  config: apiConfig,
256
261
  params: { orgId, clusterId },
257
262
  }),
258
- ConsoleBackupScheduleService.getBackupSchedule({
263
+ cliApi.getBackupSchedule({
259
264
  config: apiConfig,
260
265
  params: { orgId, clusterId },
261
266
  }),
@@ -267,7 +272,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
267
272
  setHotBackups([]);
268
273
  }
269
274
  if (scheduleResult.status === 'fulfilled') {
270
- setBackupSchedule(scheduleResult.value[0]);
275
+ setBackupSchedule(scheduleResult.value);
271
276
  }
272
277
  else {
273
278
  setBackupSchedule(undefined);
@@ -277,7 +282,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
277
282
  hotBackupsLoadedRef.current = true;
278
283
  hotBackupsLoadingRef.current = false;
279
284
  setHotBackupsLoading(false);
280
- }, [apiConfig, clusterId, isHotBackupEnabled, orgId]);
285
+ }, [apiConfig, cliApi, clusterId, isHotBackupEnabled, orgId]);
281
286
  const sseBackupsVersion = data.getSseEntityVersion(orgId, SseEntity.BACKUP, clusterId);
282
287
  useEffect(() => {
283
288
  hotBackupsLoadedRef.current = false;
@@ -671,11 +676,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
671
676
  const startingMinute = time.getUTCMinutes();
672
677
  const fieldOverrides = buildScheduleCronOverrides(scheduleFrequency, startingHour, startingMinute, scheduleWeekdays);
673
678
  const exp = CronExpression.fieldsToExpression(CronFieldCollection.from(baseCron.fields, fieldOverrides));
674
- await ConsoleBackupScheduleService.updateBackupSchedule({
675
- config: apiConfig,
676
- params: { orgId, clusterId },
677
- body: { schedule: exp.stringify() },
678
- });
679
+ await cliApi.setBackupSchedule({ config: apiConfig, params: { orgId, clusterId } }, exp.stringify());
679
680
  setEditScheduleOpen(false);
680
681
  await reloadHotBackups();
681
682
  }
@@ -741,11 +742,7 @@ const C4ClusterDetailsHotBackupsTabImpl = (props) => {
741
742
  setBackupMutationBusy(true);
742
743
  setBackupMutationError('');
743
744
  try {
744
- await ConsoleBackupScheduleService.updateBackupSchedule({
745
- config: apiConfig,
746
- params: { orgId, clusterId },
747
- body: { schedule: undefined },
748
- });
745
+ await cliApi.setBackupSchedule({ config: apiConfig, params: { orgId, clusterId } }, undefined);
749
746
  setDeleteScheduleOpen(false);
750
747
  await reloadHotBackups();
751
748
  }
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ConsoleIpWhitelistService, ConsoleSecureConnectivityService, } from '@camunda/ccma-api';
2
+ import { ConsoleSecureConnectivityService } from '@camunda/ccma-api';
3
3
  import { normalizeCIDRList, } from '@camunda/ccma-shared-types';
4
4
  import { useCallback, useEffect, useRef, useState } from 'react';
5
5
  import { C4ClusterDetailsIpWhitelist } from '../../../components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js';
6
6
  import { C4CreateIpWhitelistModal } from '../../../components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js';
7
7
  import { C4InlineNotification } from '../../../components/c4-inline-notification/c4-inline-notification.js';
8
8
  import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
9
+ import { useCliPilotApi } from '../../../runtime/use-cli-pilot-api.js';
9
10
  import { Form, Modal, Stack, TextInput } from '../../../ui/index.js';
10
11
  import { safeTranslate } from '../../../utils/safe-translate.js';
11
12
  function renderInlineStrong(value) {
@@ -113,14 +114,15 @@ export const C4ClusterDetailsIpWhitelistTab = (props) => {
113
114
  const showPrivateLinkConflictWarning = hasPrivateLink && ipWhitelistItems.length > 0;
114
115
  const privateLinkConflictTitle = safeTranslate(t, 'clusterdetails:secureConnectivity.ipAllowlistConflict.title', 'IP allowlist may block PrivateLink traffic');
115
116
  const privateLinkConflictSubtitle = safeTranslate(t, 'clusterdetails:secureConnectivity.ipAllowlistConflict.subtitle', 'The IP allowlist also applies to PrivateLink traffic. PrivateLink connections arrive with private VPC IPs (not your public or corporate IPs), so they will be blocked unless the allowlist includes your VPC CIDR. Add your VPC CIDR to the allowlist, or remove the allowlist entirely.');
117
+ const cliApi = useCliPilotApi();
116
118
  const persistIpWhitelist = useCallback(async (next) => {
117
- await ConsoleIpWhitelistService.update({
118
- config: apiConfig,
119
- params: { orgId, clusterId },
120
- body: next.map((e) => ({ ip: e.ip, description: e.description })),
121
- });
119
+ const entries = next.map((e) => ({
120
+ ip: e.ip,
121
+ description: e.description,
122
+ }));
123
+ await cliApi.setIpAllowlist({ config: apiConfig, params: { orgId, clusterId } }, entries);
122
124
  await onReloadCluster();
123
- }, [apiConfig, clusterId, orgId, onReloadCluster]);
125
+ }, [apiConfig, cliApi, clusterId, orgId, onReloadCluster]);
124
126
  const trackEvent = useCallback((eventName, message, meta) => {
125
127
  runtime.telemetry?.track?.(eventName, {
126
128
  message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.35.2",
3
+ "version": "0.35.4",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -85,8 +85,8 @@
85
85
  "react-markdown": "^8.0.7 || ^10.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@camunda/ccma-api": "11.0.0",
89
- "@camunda/ccma-shared-types": "17.0.0",
88
+ "@camunda/ccma-api": "12.0.0",
89
+ "@camunda/ccma-shared-types": "18.0.0",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",
92
92
  "mobx": "6.16.1",