@camunda/ccma-saas-frontend 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/assetUrls.d.ts +19 -0
- package/lib/esm/assetUrls.js +41 -0
- package/lib/esm/assets/ai.svg +14 -0
- package/lib/esm/assets/alerts.svg +5 -0
- package/lib/esm/assets/auditlogs.svg +9 -0
- package/lib/esm/assets/backup.svg +3 -0
- package/lib/esm/assets/clientApi.svg +10 -0
- package/lib/esm/assets/cluster.svg +4 -0
- package/lib/esm/assets/connectorSecret.svg +3 -0
- package/lib/esm/assets/consoleAPI.svg +3 -0
- package/lib/esm/assets/error.svg +11 -0
- package/lib/esm/assets/fatalError.svg +5 -0
- package/lib/esm/assets/ipwhitelist.svg +3 -0
- package/lib/esm/assets/monitoring.svg +6 -0
- package/lib/esm/assets/operatePreview.jpg +0 -0
- package/lib/esm/assets/optimizePreview.jpg +0 -0
- package/lib/esm/assets/secureConnectivity.svg +11 -0
- package/lib/esm/assets/tasklistPreview.jpg +0 -0
- package/lib/esm/assets/upgrade.svg +4 -0
- package/lib/esm/components/c4-ai-usage/c4-ai-usage.js +2 -1
- package/lib/esm/components/c4-audit-log/c4-audit-log.js +2 -1
- package/lib/esm/components/c4-cluster-byom-clients/c4-cluster-byom-clients.js +3 -2
- package/lib/esm/components/c4-cluster-details-activity/c4-cluster-details-activity.js +2 -1
- package/lib/esm/components/c4-cluster-details-alerts/c4-cluster-details-alerts.js +3 -2
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +3 -2
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js +3 -2
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js +5 -4
- package/lib/esm/components/c4-cluster-details-ip-whitelist/c4-cluster-details-ip-whitelist.js +2 -1
- package/lib/esm/components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js +10 -2
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +39 -28
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +2 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.waiting.spec.d.ts +1 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.waiting.spec.js +87 -0
- package/lib/esm/components/c4-cluster-overview/applications.d.ts +5 -1
- package/lib/esm/components/c4-cluster-overview/applications.js +52 -3
- package/lib/esm/components/c4-cluster-overview/applications.spec.d.ts +1 -0
- package/lib/esm/components/c4-cluster-overview/applications.spec.js +26 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +8 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.js +26 -7
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +4 -3
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +21 -7
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.spec.js +116 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +2 -1
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.js +1 -1
- package/lib/esm/components/c4-management-api/c4-management-api.js +2 -1
- package/lib/esm/components/c4-management-settings/c4-management-settings.js +2 -1
- package/lib/esm/externalUrls.const.d.ts +2 -1
- package/lib/esm/externalUrls.const.js +2 -1
- package/lib/esm/i18n/c4-console-i18n.js +0 -5
- package/lib/esm/i18n/en/modals/clusterclients.json +3 -0
- package/lib/esm/i18n/en/pages/clusterdetails.json +17 -1
- package/lib/esm/i18n/en/pages/createcluster.json +3 -2
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/runtime/build-cluster-swagger-url.d.ts +17 -0
- package/lib/esm/runtime/build-cluster-swagger-url.js +44 -0
- package/lib/esm/runtime/c4-console-authz.d.ts +1 -0
- package/lib/esm/runtime/c4-console-authz.js +4 -3
- package/lib/esm/runtime/c4-console-authz.spec.js +6 -2
- package/lib/esm/runtime/to-api-domain.d.ts +25 -0
- package/lib/esm/runtime/to-api-domain.js +46 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +10 -11
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +1 -1
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +0 -11
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +1 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +21 -5
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.spec.js +19 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +50 -20
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.spec.js +142 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +33 -41
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.spec.js +64 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +34 -3
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.spec.js +74 -1
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +4 -2
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +1 -1
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +7 -15
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +0 -1
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +1 -1
- package/lib/esm/widgets/group-details/c4-group-details-page.d.ts +1 -1
- package/lib/esm/widgets/group-details/c4-group-details-page.js +35 -26
- package/lib/esm/widgets/group-details/c4-group-details-page.types.d.ts +0 -1
- package/lib/esm/widgets/management/c4-management-app.js +26 -23
- package/lib/esm/widgets/user-details/c4-user-details-page.d.ts +1 -1
- package/lib/esm/widgets/user-details/c4-user-details-page.js +42 -67
- package/lib/esm/widgets/user-details/c4-user-details-page.types.d.ts +0 -1
- package/package.json +16 -16
|
@@ -10,9 +10,11 @@ import { ClusterPlanTypeAvailabilityClass, ClusterPlanTypeCategory, checkVersion
|
|
|
10
10
|
import { Checkbox, InlineNotification, Link, Modal, RadioButton, RadioButtonGroup, Stack, Tag, } from '@carbon/react';
|
|
11
11
|
import { Api_1, ApiKey, CheckmarkFilled, Renew, Security, UserAccessLocked, } from '@carbon/react/icons/index.esm.js';
|
|
12
12
|
import { Fragment, useCallback, useEffect, useMemo, useState, } from 'react';
|
|
13
|
+
import { normalizeClusterStatus } from '../../../components/c4-cluster-overview/applications.js';
|
|
13
14
|
import { C4ClusterOverview } from '../../../components/c4-cluster-overview/c4-cluster-overview.js';
|
|
14
15
|
import { C4Divider } from '../../../components/c4-divider/c4-divider.js';
|
|
15
16
|
import { C4MultiStepUglyModal } from '../../../components/c4-multi-step-modal-ugly/c4-multi-step-modal-ugly.js';
|
|
17
|
+
import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
|
|
16
18
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
17
19
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
18
20
|
// Helper function to ensure translations work
|
|
@@ -44,7 +46,7 @@ function isUuidLike(value) {
|
|
|
44
46
|
export const C4ClusterDetailsOverviewTab = (props) => {
|
|
45
47
|
const c3Profile = useC3Profile();
|
|
46
48
|
const runtime = useC4ConsoleRuntime();
|
|
47
|
-
const { cluster, clusterError, creationParameters, clustersOfOrg, clusterPlanTypeReservations, clusterLoadLatest, clusterLoadPerDay, clusterLoad24h, clusterLoadLoading, canSeeClusterLoad, canEditCluster, canWakeCluster, canManageUsers, canViewConnectorsLink, hasIdentityIntegration, orgId, clusterId, jobDashboardEnabled, jobDashboardDocsUrls, upgradeDocsUrls, statisticsConfig, apiConfig, t, onReloadCluster, onReloadClusterLoad, onNavigate, ignoreGracePeriod, clusterLoadDocsUrl, } = props;
|
|
49
|
+
const { cluster, clusterError, creationParameters, clustersOfOrg, clusterPlanTypeReservations, clusterLoadLatest, clusterLoadPerDay, clusterLoad24h, clusterLoadLoading, canSeeClusterLoad, canEditCluster, canWakeCluster, canSleepCluster, canManageUsers, canViewConnectorsLink, hasIdentityIntegration, orgId, clusterId, jobDashboardEnabled, jobDashboardDocsUrls, upgradeDocsUrls, statisticsConfig, apiConfig, t, onReloadCluster, onReloadClusterLoad, onNavigate, ignoreGracePeriod, clusterLoadDocsUrl, } = props;
|
|
48
50
|
const data = useC4ConsoleData();
|
|
49
51
|
const [tagModalOpen, setTagModalOpen] = useState(false);
|
|
50
52
|
const [selectedTag, setSelectedTag] = useState('');
|
|
@@ -937,24 +939,7 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
937
939
|
return extractVersionFromPossiblyDockerImage(version);
|
|
938
940
|
};
|
|
939
941
|
const toAppTileProps = (app) => {
|
|
940
|
-
const normalizedStatus = (
|
|
941
|
-
if (!app.status)
|
|
942
|
-
return 'unhealthy';
|
|
943
|
-
const lower = app.status.toLowerCase();
|
|
944
|
-
if (lower === 'healthy')
|
|
945
|
-
return 'healthy';
|
|
946
|
-
if (lower === 'unhealthy')
|
|
947
|
-
return 'unhealthy';
|
|
948
|
-
if (lower === 'creating')
|
|
949
|
-
return 'creating';
|
|
950
|
-
if (lower === 'updating')
|
|
951
|
-
return 'updating';
|
|
952
|
-
if (lower === 'suspended')
|
|
953
|
-
return 'suspended';
|
|
954
|
-
if (lower === 'resuming')
|
|
955
|
-
return 'resuming';
|
|
956
|
-
return 'unhealthy';
|
|
957
|
-
})();
|
|
942
|
+
const normalizedStatus = normalizeClusterStatus(app.status) ?? 'unhealthy';
|
|
958
943
|
return {
|
|
959
944
|
name: app.name,
|
|
960
945
|
status: normalizedStatus,
|
|
@@ -966,6 +951,7 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
966
951
|
};
|
|
967
952
|
};
|
|
968
953
|
const statusValue = cluster.status?.ready ?? '';
|
|
954
|
+
const normalizedReadyStatus = normalizeClusterStatus(statusValue);
|
|
969
955
|
const generationName = cluster.generation?.name ?? '-';
|
|
970
956
|
const clusterUpdateType = (() => {
|
|
971
957
|
const zeebeStatus = cluster.status?.zeebeStatus;
|
|
@@ -1043,6 +1029,13 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1043
1029
|
operator: VersionCheckOperator.GreaterThanOrEqual,
|
|
1044
1030
|
});
|
|
1045
1031
|
const identityName = isAdminVersion ? 'Admin' : 'Identity';
|
|
1032
|
+
const supportsSwagger = checkVersion({
|
|
1033
|
+
possiblyVersionOrDockerPath: cluster.generation?.versions?.zeebe,
|
|
1034
|
+
trueForSnapshot: true,
|
|
1035
|
+
trueOnInvalidVersion: false,
|
|
1036
|
+
versionToCompareTo: '8.8.0-alpha8',
|
|
1037
|
+
operator: VersionCheckOperator.GreaterThanOrEqual,
|
|
1038
|
+
});
|
|
1046
1039
|
const apps = {
|
|
1047
1040
|
zeebe: toAppTileProps({
|
|
1048
1041
|
name: 'Zeebe',
|
|
@@ -1276,6 +1269,19 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1276
1269
|
status: {
|
|
1277
1270
|
label: safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.label', 'Status'),
|
|
1278
1271
|
value: statusValue,
|
|
1272
|
+
infoTooltip: normalizedReadyStatus === 'waitingForInput'
|
|
1273
|
+
? safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.waitingForInputTooltip', 'Waiting for external encryption to be configured')
|
|
1274
|
+
: undefined,
|
|
1275
|
+
onInfoClick: normalizedReadyStatus === 'waitingForInput'
|
|
1276
|
+
? () => {
|
|
1277
|
+
props.onNavigate?.({
|
|
1278
|
+
kind: 'tabChange',
|
|
1279
|
+
orgId,
|
|
1280
|
+
clusterId,
|
|
1281
|
+
tabId: 'encryption',
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
: undefined,
|
|
1279
1285
|
wakeAction: async () => {
|
|
1280
1286
|
const { ConsoleClusterService } = await import('@camunda/ccma-api');
|
|
1281
1287
|
await ConsoleClusterService.wakeCluster({
|
|
@@ -1286,7 +1292,7 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1286
1292
|
},
|
|
1287
1293
|
wakeLabel: safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeLabel', 'Resume cluster'),
|
|
1288
1294
|
wakeVisibility: canWakeCluster,
|
|
1289
|
-
sleepAction:
|
|
1295
|
+
sleepAction: canSleepCluster
|
|
1290
1296
|
? async () => {
|
|
1291
1297
|
const { ConsoleClusterService } = await import('@camunda/ccma-api');
|
|
1292
1298
|
await ConsoleClusterService.suspendCluster({
|
|
@@ -1307,6 +1313,30 @@ export const C4ClusterDetailsOverviewTab = (props) => {
|
|
|
1307
1313
|
label: safeTranslate(t, 'clusterdetails:overview.clusterDetails.createdAt', 'Created at'),
|
|
1308
1314
|
value: formatDate(cluster.created),
|
|
1309
1315
|
},
|
|
1316
|
+
...(() => {
|
|
1317
|
+
if (!supportsSwagger)
|
|
1318
|
+
return {};
|
|
1319
|
+
const url = buildClusterSwaggerUrl({
|
|
1320
|
+
cluster,
|
|
1321
|
+
clusterId,
|
|
1322
|
+
stage: runtime.stage,
|
|
1323
|
+
});
|
|
1324
|
+
if (!url)
|
|
1325
|
+
return {};
|
|
1326
|
+
const isClusterPaused = normalizedReadyStatus === 'suspended';
|
|
1327
|
+
return {
|
|
1328
|
+
swaggerUrl: {
|
|
1329
|
+
label: safeTranslate(t, 'clusterdetails:overview.clusterDetails.swaggerUrl', 'Swagger UI'),
|
|
1330
|
+
linkLabel: safeTranslate(t, 'clusterdetails:overview.clusterDetails.openSwaggerUi', 'Open Swagger UI'),
|
|
1331
|
+
url,
|
|
1332
|
+
...(isClusterPaused
|
|
1333
|
+
? {
|
|
1334
|
+
pausedWarning: safeTranslate(t, 'clusterdetails:overview.clusterDetails.swaggerUiPausedWarning', 'Not accessible while the cluster is paused'),
|
|
1335
|
+
}
|
|
1336
|
+
: {}),
|
|
1337
|
+
},
|
|
1338
|
+
};
|
|
1339
|
+
})(),
|
|
1310
1340
|
};
|
|
1311
1341
|
return (_jsxs(Stack, { gap: 6, children: [_jsx(C4MultiStepUglyModal, { open: upgradeModalOpen, onClose: () => setUpgradeModalOpen(false), steps: upgradeSteps }, upgradeModalOpen ? 'upgrade-open' : 'upgrade-closed'), _jsx(Modal, { open: hardwareModalOpen, modalHeading: safeTranslate(t, 'clusterdetails:overview.hardwarePackageModal.heading', 'Adjust cluster size'), primaryButtonText: safeTranslate(t, 'clusterdetails:overview.hardwarePackageModal.primary', 'Confirm'), secondaryButtonText: safeTranslate(t, 'clusterdetails:overview.hardwarePackageModal.secondary', 'Cancel'), primaryButtonDisabled: hardwareBusy ||
|
|
1312
1342
|
!canModifyHardwarePackages ||
|
|
@@ -116,6 +116,7 @@ const defaultProps = {
|
|
|
116
116
|
canSeeClusterLoad: false,
|
|
117
117
|
canEditCluster: false,
|
|
118
118
|
canWakeCluster: false,
|
|
119
|
+
canSleepCluster: false,
|
|
119
120
|
canManageUsers: false,
|
|
120
121
|
canViewConnectorsLink: true,
|
|
121
122
|
hasIdentityIntegration: false,
|
|
@@ -175,6 +176,16 @@ describe('C4ClusterDetailsOverviewTab job statistics fetching', () => {
|
|
|
175
176
|
expect(SaaSJobsService.getJobStatisticsGlobal).toHaveBeenCalledTimes(1);
|
|
176
177
|
});
|
|
177
178
|
});
|
|
179
|
+
it('allows waking suspended clusters without exposing manual suspend', async () => {
|
|
180
|
+
renderTab({
|
|
181
|
+
cluster: buildCluster('Suspended'),
|
|
182
|
+
canWakeCluster: true,
|
|
183
|
+
canSleepCluster: false,
|
|
184
|
+
});
|
|
185
|
+
await screen.findByTestId('cluster-overview');
|
|
186
|
+
expect(lastOverviewProps?.details.status?.wakeVisibility).toBe(true);
|
|
187
|
+
expect(lastOverviewProps?.details.status?.sleepAction).toBeUndefined();
|
|
188
|
+
});
|
|
178
189
|
it('does not re-fetch when the cluster prop receives a new object reference with the same status.ready', async () => {
|
|
179
190
|
const { rerender } = renderTab({ cluster: buildCluster('Healthy') });
|
|
180
191
|
await waitFor(() => {
|
|
@@ -196,6 +207,24 @@ describe('C4ClusterDetailsOverviewTab job statistics fetching', () => {
|
|
|
196
207
|
expect(SaaSJobsService.getJobStatisticsGlobal).toHaveBeenCalledTimes(1);
|
|
197
208
|
}, { timeout: 200 });
|
|
198
209
|
});
|
|
210
|
+
it('wires waiting for input status info to the encryption tab', async () => {
|
|
211
|
+
const onNavigate = vi.fn();
|
|
212
|
+
renderTab({
|
|
213
|
+
cluster: buildCluster('WaitingForInput'),
|
|
214
|
+
onNavigate,
|
|
215
|
+
});
|
|
216
|
+
await screen.findByTestId('cluster-overview');
|
|
217
|
+
expect(lastOverviewProps?.details.status?.infoTooltip).toBe('Waiting for external encryption to be configured');
|
|
218
|
+
act(() => {
|
|
219
|
+
lastOverviewProps?.details.status?.onInfoClick?.();
|
|
220
|
+
});
|
|
221
|
+
expect(onNavigate).toHaveBeenCalledWith({
|
|
222
|
+
kind: 'tabChange',
|
|
223
|
+
orgId: 'org-1',
|
|
224
|
+
clusterId: 'cluster-1',
|
|
225
|
+
tabId: 'encryption',
|
|
226
|
+
});
|
|
227
|
+
});
|
|
199
228
|
it('re-fetches when the cluster transitions from unhealthy to healthy', async () => {
|
|
200
229
|
const { rerender } = renderTab({ cluster: buildCluster('Creating') });
|
|
201
230
|
// Wait for the component to render; the API should not be called for a non-healthy cluster
|
|
@@ -586,3 +615,116 @@ describe('C4ClusterDetailsOverviewTab hardware packages', () => {
|
|
|
586
615
|
expect(document.getElementById('allocatedHardwarePackages-4')).toHaveAttribute('disabled');
|
|
587
616
|
});
|
|
588
617
|
});
|
|
618
|
+
describe('C4ClusterDetailsOverviewTab swagger URL', () => {
|
|
619
|
+
beforeEach(() => {
|
|
620
|
+
lastOverviewProps = undefined;
|
|
621
|
+
vi.mocked(SaaSJobsService.getJobStatisticsGlobal).mockResolvedValue(undefined);
|
|
622
|
+
});
|
|
623
|
+
afterEach(() => {
|
|
624
|
+
cleanup();
|
|
625
|
+
});
|
|
626
|
+
it('populates swaggerUrl with api.* URL for 8.9+ clusters', async () => {
|
|
627
|
+
renderTab({
|
|
628
|
+
cluster: {
|
|
629
|
+
...buildCluster('Healthy'),
|
|
630
|
+
status: {
|
|
631
|
+
...buildCluster('Healthy').status,
|
|
632
|
+
operateUrl: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1',
|
|
633
|
+
},
|
|
634
|
+
externalMetadata: { swagger: true },
|
|
635
|
+
},
|
|
636
|
+
});
|
|
637
|
+
await screen.findByTestId('cluster-overview');
|
|
638
|
+
// default zeebeVersion is 8.9.0 → api.dev.ultrawombat.com; path /swagger
|
|
639
|
+
expect(lastOverviewProps?.details?.swaggerUrl).toEqual({
|
|
640
|
+
label: 'Swagger UI',
|
|
641
|
+
linkLabel: 'Open Swagger UI',
|
|
642
|
+
url: 'https://lpp-1.api.dev.ultrawombat.com/cluster-1/swagger',
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
it('populates swaggerUrl with operate.* URL for 8.8.x clusters', async () => {
|
|
646
|
+
renderTab({
|
|
647
|
+
cluster: {
|
|
648
|
+
...buildCluster('Healthy', { zeebeVersion: 'zeebe:8.8.0-alpha8' }),
|
|
649
|
+
status: {
|
|
650
|
+
...buildCluster('Healthy').status,
|
|
651
|
+
operateUrl: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1',
|
|
652
|
+
},
|
|
653
|
+
externalMetadata: { swagger: true },
|
|
654
|
+
},
|
|
655
|
+
});
|
|
656
|
+
await screen.findByTestId('cluster-overview');
|
|
657
|
+
// 8.8.0-alpha8 < 8.9.0 → operate.dev.ultrawombat.com; path /swagger-ui/index.html
|
|
658
|
+
expect(lastOverviewProps?.details?.swaggerUrl).toEqual({
|
|
659
|
+
label: 'Swagger UI',
|
|
660
|
+
linkLabel: 'Open Swagger UI',
|
|
661
|
+
url: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1/swagger-ui/index.html',
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
it('omits swaggerUrl when swagger is disabled in externalMetadata', async () => {
|
|
665
|
+
renderTab({
|
|
666
|
+
cluster: {
|
|
667
|
+
...buildCluster('Healthy'),
|
|
668
|
+
status: {
|
|
669
|
+
...buildCluster('Healthy').status,
|
|
670
|
+
operateUrl: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1',
|
|
671
|
+
},
|
|
672
|
+
externalMetadata: { swagger: false },
|
|
673
|
+
},
|
|
674
|
+
});
|
|
675
|
+
await screen.findByTestId('cluster-overview');
|
|
676
|
+
expect(lastOverviewProps?.details?.swaggerUrl).toBeUndefined();
|
|
677
|
+
});
|
|
678
|
+
it('omits swaggerUrl when cluster version is below 8.8.0-alpha8', async () => {
|
|
679
|
+
renderTab({
|
|
680
|
+
cluster: {
|
|
681
|
+
...buildCluster('Healthy', { zeebeVersion: 'zeebe:8.7.0' }),
|
|
682
|
+
status: {
|
|
683
|
+
...buildCluster('Healthy').status,
|
|
684
|
+
operateUrl: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1',
|
|
685
|
+
},
|
|
686
|
+
externalMetadata: { swagger: true },
|
|
687
|
+
},
|
|
688
|
+
});
|
|
689
|
+
await screen.findByTestId('cluster-overview');
|
|
690
|
+
expect(lastOverviewProps?.details?.swaggerUrl).toBeUndefined();
|
|
691
|
+
});
|
|
692
|
+
it('omits swaggerUrl when operateUrl is absent', async () => {
|
|
693
|
+
renderTab({
|
|
694
|
+
cluster: {
|
|
695
|
+
...buildCluster('Healthy'),
|
|
696
|
+
externalMetadata: { swagger: true },
|
|
697
|
+
},
|
|
698
|
+
});
|
|
699
|
+
await screen.findByTestId('cluster-overview');
|
|
700
|
+
expect(lastOverviewProps?.details?.swaggerUrl).toBeUndefined();
|
|
701
|
+
});
|
|
702
|
+
it('includes pausedWarning in swaggerUrl when cluster is suspended', async () => {
|
|
703
|
+
renderTab({
|
|
704
|
+
cluster: {
|
|
705
|
+
...buildCluster('Suspended'),
|
|
706
|
+
status: {
|
|
707
|
+
...buildCluster('Suspended').status,
|
|
708
|
+
operateUrl: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1',
|
|
709
|
+
},
|
|
710
|
+
externalMetadata: { swagger: true },
|
|
711
|
+
},
|
|
712
|
+
});
|
|
713
|
+
await screen.findByTestId('cluster-overview');
|
|
714
|
+
expect(lastOverviewProps?.details?.swaggerUrl?.pausedWarning).toBe('Not accessible while the cluster is paused');
|
|
715
|
+
});
|
|
716
|
+
it('does not include pausedWarning when cluster is healthy', async () => {
|
|
717
|
+
renderTab({
|
|
718
|
+
cluster: {
|
|
719
|
+
...buildCluster('Healthy'),
|
|
720
|
+
status: {
|
|
721
|
+
...buildCluster('Healthy').status,
|
|
722
|
+
operateUrl: 'https://lpp-1.operate.dev.ultrawombat.com/cluster-1',
|
|
723
|
+
},
|
|
724
|
+
externalMetadata: { swagger: true },
|
|
725
|
+
},
|
|
726
|
+
});
|
|
727
|
+
await screen.findByTestId('cluster-overview');
|
|
728
|
+
expect(lastOverviewProps?.details?.swaggerUrl?.pausedWarning).toBeUndefined();
|
|
729
|
+
});
|
|
730
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ConsoleSecureConnectivityService } from '@camunda/ccma-api';
|
|
3
3
|
import { isValidAwsArn, isValidPrivateLinkRegion, PRIVATE_LINK_REGIONS, SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT, SseEntity, } from '@camunda/ccma-shared-types';
|
|
4
|
-
import { Button, ButtonSet, ComposedModal,
|
|
4
|
+
import { Button, ButtonSet, ComposedModal, FilterableMultiSelect, InlineLoading, InlineNotification, Modal, ModalBody, ModalFooter, ModalHeader, ProgressIndicator, ProgressStep, Stack, StructuredListBody, StructuredListCell, StructuredListRow, StructuredListWrapper, TextInput, Tile, } from '@carbon/react';
|
|
5
5
|
import { Checkmark, Close } from '@carbon/react/icons/index.esm.js';
|
|
6
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { C4ClusterDetailsSecureConnectivity } from '../../../components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
|
|
@@ -68,9 +68,9 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
68
68
|
const [secureConnectivityDeactivating, setSecureConnectivityDeactivating] = useState(false);
|
|
69
69
|
const [secureConnectivityDeactivateOpen, setSecureConnectivityDeactivateOpen,] = useState(false);
|
|
70
70
|
const [allowedPrincipalInput, setAllowedPrincipalInput] = useState('');
|
|
71
|
-
const [allowedRegionInput, setAllowedRegionInput] = useState('');
|
|
72
71
|
const [allowedPrincipals, setAllowedPrincipals] = useState([]);
|
|
73
72
|
const [allowedRegions, setAllowedRegions] = useState([]);
|
|
73
|
+
const [showAllowedRegionsLimitReached, setShowAllowedRegionsLimitReached] = useState(false);
|
|
74
74
|
const [showNoPrincipalsError, setShowNoPrincipalsError] = useState(false);
|
|
75
75
|
const [showNoRegionsError, setShowNoRegionsError] = useState(false);
|
|
76
76
|
const [secureConnectivityMutationBusy, setSecureConnectivityMutationBusy] = useState(false);
|
|
@@ -78,11 +78,9 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
78
78
|
const hasTooManyAllowedPrincipals = allowedPrincipals.length > SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT;
|
|
79
79
|
const hasTooManyAllowedRegions = allowedRegions.length > SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT;
|
|
80
80
|
const hasReachedAllowedPrincipalsLimit = allowedPrincipals.length >= SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT;
|
|
81
|
-
const hasReachedAllowedRegionsLimit = allowedRegions.length >= SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT;
|
|
82
81
|
const showAllowedPrincipalsLimitError = hasTooManyAllowedPrincipals ||
|
|
83
82
|
(hasReachedAllowedPrincipalsLimit && allowedPrincipalInput.length > 0);
|
|
84
|
-
const showAllowedRegionsLimitError = hasTooManyAllowedRegions ||
|
|
85
|
-
(hasReachedAllowedRegionsLimit && allowedRegionInput.length > 0);
|
|
83
|
+
const showAllowedRegionsLimitError = hasTooManyAllowedRegions || showAllowedRegionsLimitReached;
|
|
86
84
|
const allowedPrincipalsLimitText = `Up to ${SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT} principals can be added.`;
|
|
87
85
|
const allowedRegionsLimitText = `Up to ${SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT} regions can be added.`;
|
|
88
86
|
const validateArn = (possibleArn) => {
|
|
@@ -156,48 +154,38 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
156
154
|
}, children: _jsx("span", { style: { flexGrow: 1 }, children: "No principals added" }) }) }) })) }) })] }));
|
|
157
155
|
};
|
|
158
156
|
const renderAllowedRegionsEditor = () => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
minHeight: '0px',
|
|
181
|
-
whiteSpace: 'nowrap',
|
|
182
|
-
marginTop: 'var(--cds-spacing-06)',
|
|
183
|
-
}, disabled: hasReachedAllowedRegionsLimit ||
|
|
184
|
-
!allowedRegionInput ||
|
|
185
|
-
allowedRegions.includes(allowedRegionInput), onClick: () => {
|
|
186
|
-
setAllowedRegions([...allowedRegions, allowedRegionInput]);
|
|
187
|
-
setAllowedRegionInput('');
|
|
188
|
-
setShowNoRegionsError(false);
|
|
189
|
-
setSecureConnectivityMutationError('');
|
|
190
|
-
}, children: "Add region" })] }), _jsx("p", { style: {
|
|
157
|
+
const regionItems = [...PRIVATE_LINK_REGIONS]
|
|
158
|
+
.sort()
|
|
159
|
+
.map((region) => ({
|
|
160
|
+
id: region,
|
|
161
|
+
label: region,
|
|
162
|
+
}));
|
|
163
|
+
const selectedRegionItems = regionItems.filter((region) => allowedRegions.includes(region.id));
|
|
164
|
+
return (_jsxs(Stack, { gap: 6, children: [_jsxs(Stack, { gap: 3, children: [_jsx("h4", { style: headingCompact01Style, children: "Supported regions for the endpoint service" }), _jsx("p", { style: { margin: 0 }, children: "Define the supported regions for endpoint connections that can connect to the service. Use of cross regions may incur extra costs." })] }), _jsx(FilterableMultiSelect, { id: 'private-link-allowed-region-input', titleText: 'Region code', placeholder: 'Select region', helperText: 'Search and select one or more AWS regions.', direction: 'top', autoAlign: true, items: regionItems, itemToString: (item) => item?.label ?? '', selectedItems: selectedRegionItems, invalidText: showAllowedRegionsLimitError
|
|
165
|
+
? allowedRegionsLimitText
|
|
166
|
+
: showNoRegionsError
|
|
167
|
+
? 'At least one region must be added.'
|
|
168
|
+
: 'Invalid region id', invalid: showAllowedRegionsLimitError || showNoRegionsError, onChange: (e) => {
|
|
169
|
+
const nextAllowedRegions = (e.selectedItems ?? [])
|
|
170
|
+
.filter((region) => typeof region?.id === 'string')
|
|
171
|
+
.map((region) => region.id);
|
|
172
|
+
setShowNoRegionsError(false);
|
|
173
|
+
setShowAllowedRegionsLimitReached(nextAllowedRegions.length >
|
|
174
|
+
SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT);
|
|
175
|
+
setSecureConnectivityMutationError('');
|
|
176
|
+
setAllowedRegions(nextAllowedRegions.slice(0, SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT));
|
|
177
|
+
} }), _jsx("p", { style: {
|
|
191
178
|
margin: 0,
|
|
192
179
|
fontSize: '0.875rem',
|
|
193
180
|
fontWeight: 600,
|
|
194
181
|
color: 'var(--cds-text-secondary)',
|
|
195
|
-
}, children: "
|
|
182
|
+
}, children: "Selected regions" }), _jsx(StructuredListWrapper, { isCondensed: true, isFlush: true, children: _jsx(StructuredListBody, { children: allowedRegions.length > 0 ? (allowedRegions.map((region) => (_jsx(StructuredListRow, { children: _jsx(StructuredListCell, { children: _jsxs("div", { style: {
|
|
196
183
|
display: 'flex',
|
|
197
184
|
alignItems: 'center',
|
|
198
185
|
justifyContent: 'space-between',
|
|
199
186
|
gap: 'var(--cds-spacing-05)',
|
|
200
187
|
}, children: [_jsx("span", { style: { flexGrow: 1 }, children: region }), _jsx(Button, { kind: 'ghost', size: 'sm', hasIconOnly: true, renderIcon: Close, iconDescription: 'Remove region', onClick: () => {
|
|
188
|
+
setShowAllowedRegionsLimitReached(false);
|
|
201
189
|
setSecureConnectivityMutationError('');
|
|
202
190
|
setAllowedRegions(allowedRegions.filter((item) => item !== region));
|
|
203
191
|
} })] }) }) }, region)))) : (_jsx(StructuredListRow, { children: _jsx(StructuredListCell, { children: _jsx("div", { style: {
|
|
@@ -286,9 +274,9 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
286
274
|
})();
|
|
287
275
|
const resetSecureConnectivityForm = useCallback(() => {
|
|
288
276
|
setAllowedPrincipalInput('');
|
|
289
|
-
setAllowedRegionInput('');
|
|
290
277
|
setAllowedPrincipals([]);
|
|
291
278
|
setAllowedRegions([]);
|
|
279
|
+
setShowAllowedRegionsLimitReached(false);
|
|
292
280
|
setShowNoPrincipalsError(false);
|
|
293
281
|
setShowNoRegionsError(false);
|
|
294
282
|
setSecureConnectivityMutationError('');
|
|
@@ -298,9 +286,9 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
298
286
|
}, [defaultClusterRegion]);
|
|
299
287
|
const loadExistingSecureConnectivityValues = useCallback(() => {
|
|
300
288
|
setAllowedPrincipalInput('');
|
|
301
|
-
setAllowedRegionInput('');
|
|
302
289
|
setAllowedPrincipals(secureConnectivityStatus?.spec.allowedPrincipals ?? []);
|
|
303
290
|
const regionsFromStatus = secureConnectivityStatus?.spec.allowedRegions ?? [];
|
|
291
|
+
setShowAllowedRegionsLimitReached(false);
|
|
304
292
|
setAllowedRegions(regionsFromStatus.length ? regionsFromStatus : getDefaultAllowedRegions());
|
|
305
293
|
setShowNoPrincipalsError(false);
|
|
306
294
|
setShowNoRegionsError(false);
|
|
@@ -351,6 +339,10 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
351
339
|
: safeTranslate(t, 'clusterdetails:secureConnectivity.updatePrincipalsModalHeading', 'Edit allowed principals');
|
|
352
340
|
const updateModalErrorTitle = safeTranslate(t, 'clusterdetails:secureConnectivity.updateModalErrorTitle', 'Update failed');
|
|
353
341
|
const updateModalSaveLabel = safeTranslate(t, 'clusterdetails:secureConnectivity.updateModalSave', 'Save changes');
|
|
342
|
+
const isUpdateModalSaveDisabled = secureConnectivityMutationBusy ||
|
|
343
|
+
(secureConnectivityEditMode === 'principals' &&
|
|
344
|
+
hasTooManyAllowedPrincipals) ||
|
|
345
|
+
(secureConnectivityEditMode === 'regions' && hasTooManyAllowedRegions);
|
|
354
346
|
const emptyDescription = (_jsxs(Stack, { gap: 6, children: [_jsx("p", { children: safeTranslate(t, 'clusterdetails:secureConnectivity.description0', 'Private networking allows you to connect privately to the cluster using inbound AWS PrivateLink.') }), _jsx("p", { children: safeTranslate(t, 'clusterdetails:secureConnectivity.description1', 'With inbound PrivateLink, traffic from your AWS VPC to Camunda cluster is routed privately and never traverses the public internet. This enables job workers and inbound connectors to run inside your own network while securely accessing Camunda.') }), showActivatingTile ? (_jsx(Tile, { light: true, children: _jsxs(Stack, { gap: 2, children: [_jsx(InlineLoading, { description: safeTranslate(t, 'clusterdetails:secureConnectivity.activatingTitle', 'Activating PrivateLink endpoint service…') }), _jsxs(Stack, { gap: 1, children: [_jsx("p", { children: safeTranslate(t, 'clusterdetails:secureConnectivity.activatingText0', 'This may take a few minutes.') }), _jsx("p", { children: safeTranslate(t, 'clusterdetails:secureConnectivity.activatingText1', 'You can leave this page. We will notify you when the endpoint service is ready.') })] })] }) })) : undefined] }));
|
|
355
347
|
return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsSecureConnectivity, { status: secureConnectivityStatus, privateEndpoints: privateEndpoints, connectInAwsUrl: 'https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html', isLoading: isSecureConnectivityLoadingVisible, isDeactivating: secureConnectivityDeactivating, text: {
|
|
356
348
|
title: safeTranslate(t, 'clusterdetails:secureConnectivity.title', 'Private networking'),
|
|
@@ -519,7 +511,7 @@ export const C4ClusterDetailsSecureConnectivityTab = (props) => {
|
|
|
519
511
|
return true;
|
|
520
512
|
}, children: [_jsx(ModalHeader, { title: updateModalTitle }), _jsx(ModalBody, { hasForm: true, children: _jsxs(Stack, { gap: 6, children: [secureConnectivityMutationError && (_jsx(InlineNotification, { kind: 'error', lowContrast: true, title: updateModalErrorTitle, subtitle: secureConnectivityMutationError, onCloseButtonClick: () => setSecureConnectivityMutationError('') })), secureConnectivityEditMode === 'regions'
|
|
521
513
|
? renderAllowedRegionsEditor()
|
|
522
|
-
: renderAllowedPrincipalsEditor('updateModal')] }) }), _jsx(ModalFooter, { children: _jsxs(ButtonSet, { style: { width: '100%' }, children: [_jsx(Button, { kind: 'secondary', disabled: secureConnectivityMutationBusy, onClick: closeUpdateModal, size: 'xl', style: { flex: 1, maxInlineSize: '100%' }, children: "Cancel" }), _jsx(Button, { kind: 'primary', disabled:
|
|
514
|
+
: renderAllowedPrincipalsEditor('updateModal')] }) }), _jsx(ModalFooter, { children: _jsxs(ButtonSet, { style: { width: '100%' }, children: [_jsx(Button, { kind: 'secondary', disabled: secureConnectivityMutationBusy, onClick: closeUpdateModal, size: 'xl', style: { flex: 1, maxInlineSize: '100%' }, children: "Cancel" }), _jsx(Button, { kind: 'primary', disabled: isUpdateModalSaveDisabled, onClick: () => {
|
|
523
515
|
if (secureConnectivityEditMode === 'principals') {
|
|
524
516
|
if (hasTooManyAllowedPrincipals) {
|
|
525
517
|
setSecureConnectivityMutationError(allowedPrincipalsLimitText);
|
package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.spec.js
CHANGED
|
@@ -243,10 +243,74 @@ describe('C4ClusterDetailsSecureConnectivityTab telemetry', () => {
|
|
|
243
243
|
expect(screen.getByRole('button', { name: 'Edit supported regions' })).toBeInTheDocument();
|
|
244
244
|
});
|
|
245
245
|
await userEvent.click(screen.getByRole('button', { name: 'Edit supported regions' }));
|
|
246
|
+
expect(screen.getByRole('button', { name: 'Save changes' })).toBeDisabled();
|
|
246
247
|
await userEvent.click(screen.getByRole('button', { name: 'Save changes' }));
|
|
247
248
|
expect(ConsoleSecureConnectivityService.update).not.toHaveBeenCalled();
|
|
248
249
|
expect(screen.getAllByText(`Up to ${SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT} regions can be added.`).length).toBeGreaterThan(0);
|
|
249
250
|
});
|
|
251
|
+
it('allows selecting an additional region in the update modal', async () => {
|
|
252
|
+
vi.mocked(ConsoleSecureConnectivityService.getStatus).mockResolvedValue({
|
|
253
|
+
metadata: { namespace: 'ns' },
|
|
254
|
+
spec: {
|
|
255
|
+
allowedPrincipals: ['arn:aws:iam::123456789012:role/test'],
|
|
256
|
+
allowedRegions: ['us-east-1'],
|
|
257
|
+
},
|
|
258
|
+
status: {
|
|
259
|
+
endpointConnectionCount: 0,
|
|
260
|
+
endpointConnections: [],
|
|
261
|
+
conditions: [{ type: 'Ready', status: 'True' }],
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
vi.mocked(ConsoleSecureConnectivityService.update).mockResolvedValue(undefined);
|
|
265
|
+
renderTab();
|
|
266
|
+
await userEvent.click(await screen.findByRole('button', { name: 'Edit supported regions' }));
|
|
267
|
+
await userEvent.click(screen.getByRole('button', { name: 'Open' }));
|
|
268
|
+
await userEvent.click(await screen.findByText('eu-central-1'));
|
|
269
|
+
await userEvent.click(screen.getByRole('button', { name: 'Save changes' }));
|
|
270
|
+
await waitFor(() => {
|
|
271
|
+
expect(ConsoleSecureConnectivityService.update).toHaveBeenCalledWith(expect.objectContaining({
|
|
272
|
+
body: expect.objectContaining({
|
|
273
|
+
allowedPrincipals: ['arn:aws:iam::123456789012:role/test'],
|
|
274
|
+
allowedRegions: ['us-east-1', 'eu-central-1'],
|
|
275
|
+
}),
|
|
276
|
+
}));
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
it('caps region selection at the limit when choosing more than the allowed number', async () => {
|
|
280
|
+
const allowedRegionsAtLimit = PRIVATE_LINK_REGIONS.slice(0, SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT);
|
|
281
|
+
const extraRegion = PRIVATE_LINK_REGIONS.at(SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT);
|
|
282
|
+
if (!extraRegion) {
|
|
283
|
+
throw new Error('Expected an extra region beyond the configured limit');
|
|
284
|
+
}
|
|
285
|
+
vi.mocked(ConsoleSecureConnectivityService.getStatus).mockResolvedValue({
|
|
286
|
+
metadata: { namespace: 'ns' },
|
|
287
|
+
spec: {
|
|
288
|
+
allowedPrincipals: ['arn:aws:iam::123456789012:role/test'],
|
|
289
|
+
allowedRegions: allowedRegionsAtLimit,
|
|
290
|
+
},
|
|
291
|
+
status: {
|
|
292
|
+
endpointConnectionCount: 0,
|
|
293
|
+
endpointConnections: [],
|
|
294
|
+
conditions: [{ type: 'Ready', status: 'True' }],
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
vi.mocked(ConsoleSecureConnectivityService.update).mockResolvedValue(undefined);
|
|
298
|
+
renderTab();
|
|
299
|
+
await userEvent.click(await screen.findByRole('button', { name: 'Edit supported regions' }));
|
|
300
|
+
await userEvent.click(screen.getByRole('button', { name: 'Open' }));
|
|
301
|
+
await userEvent.click(await screen.findByText(extraRegion));
|
|
302
|
+
expect(screen.getAllByText(`Up to ${SECURE_CONNECTIVITY_ALLOWED_ENTRIES_LIMIT} regions can be added.`).length).toBeGreaterThan(0);
|
|
303
|
+
expect(screen.queryAllByText(extraRegion)).toHaveLength(1);
|
|
304
|
+
await userEvent.click(screen.getByRole('button', { name: 'Save changes' }));
|
|
305
|
+
await waitFor(() => {
|
|
306
|
+
expect(ConsoleSecureConnectivityService.update).toHaveBeenCalledWith(expect.objectContaining({
|
|
307
|
+
body: expect.objectContaining({
|
|
308
|
+
allowedPrincipals: ['arn:aws:iam::123456789012:role/test'],
|
|
309
|
+
allowedRegions: allowedRegionsAtLimit,
|
|
310
|
+
}),
|
|
311
|
+
}));
|
|
312
|
+
});
|
|
313
|
+
});
|
|
250
314
|
it('reloads status when the tab becomes active again after being inactive', async () => {
|
|
251
315
|
vi.mocked(ConsoleSecureConnectivityService.getStatus)
|
|
252
316
|
.mockResolvedValueOnce({
|
|
@@ -4,6 +4,7 @@ import { checkVersion, VersionCheckOperator, } from '@camunda/ccma-shared-types'
|
|
|
4
4
|
import { InlineNotification, Link, Modal } from '@carbon/react';
|
|
5
5
|
import { Fragment, useCallback, useMemo, useState, } from 'react';
|
|
6
6
|
import { C4ClusterSettings } from '../../../components/c4-cluster-settings/c4-cluster-settings.js';
|
|
7
|
+
import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
|
|
7
8
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
8
9
|
// Helper to translate with fallback
|
|
9
10
|
function safeTranslate(translateFn, key, fallback, options) {
|
|
@@ -44,6 +45,8 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
44
45
|
const [isUpdatingMcp, setIsUpdatingMcp] = useState(false);
|
|
45
46
|
const [isUpdatingBusinessIdUniqueness, setIsUpdatingBusinessIdUniqueness] = useState(false);
|
|
46
47
|
const [isUpdatingTasklistV2, setIsUpdatingTasklistV2] = useState(false);
|
|
48
|
+
const [showTasklistV2ConfirmModal, setShowTasklistV2ConfirmModal] = useState(false);
|
|
49
|
+
const [tasklistV2UpgradeError, setTasklistV2UpgradeError] = useState(undefined);
|
|
47
50
|
const [isUpdatingRba, setIsUpdatingRba] = useState(false);
|
|
48
51
|
const [isUpdatingIdentityAuthorizations, setIsUpdatingIdentityAuthorizations,] = useState(false);
|
|
49
52
|
const [rbaError, setRbaError] = useState(false);
|
|
@@ -296,6 +299,18 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
296
299
|
setIsUpdatingTasklistV2(false);
|
|
297
300
|
}
|
|
298
301
|
}, [props, runtime.telemetry]);
|
|
302
|
+
const submitTasklistV2Upgrade = useCallback(async () => {
|
|
303
|
+
setTasklistV2UpgradeError(undefined);
|
|
304
|
+
try {
|
|
305
|
+
await toggleTasklistV2();
|
|
306
|
+
setShowTasklistV2ConfirmModal(false);
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
setTasklistV2UpgradeError(error instanceof Error
|
|
310
|
+
? error.message
|
|
311
|
+
: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.modal.error', "We're having trouble upgrading to Tasklist v2. Please try again later."));
|
|
312
|
+
}
|
|
313
|
+
}, [toggleTasklistV2, props.t]);
|
|
299
314
|
const updateResourceBasedAuthorizations = useCallback(async (nextState) => {
|
|
300
315
|
runtime.telemetry?.track?.(`resourceBasedAuthorizations:${nextState}:confirm`, {
|
|
301
316
|
message: `Confirm ${nextState} resource-based authorizations`,
|
|
@@ -551,7 +566,16 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
551
566
|
...(isSwaggerToggleVisible && {
|
|
552
567
|
swaggerToggle: {
|
|
553
568
|
enabled: props.cluster.externalMetadata?.swagger ?? true,
|
|
554
|
-
description: (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.swagger.description', 'The Orchestration Cluster REST API is documented using the'), ' ', _jsx(Link, { href: 'https://github.com/camunda/camunda/blob/main/zeebe/gateway-protocol/src/main/proto/rest-api.yaml', target: '_blank', children: safeTranslate(props.t, 'clusterdetails:settings.swagger.spec', 'OpenAPI specification') }), safeTranslate(props.t, 'clusterdetails:settings.swagger.description2', '. When enabled, it is accessible via Swagger UI.'), _jsx("br", {}), _jsx("br", {}),
|
|
569
|
+
description: (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.swagger.description', 'The Orchestration Cluster REST API is documented using the'), ' ', _jsx(Link, { href: 'https://github.com/camunda/camunda/blob/main/zeebe/gateway-protocol/src/main/proto/rest-api.yaml', target: '_blank', children: safeTranslate(props.t, 'clusterdetails:settings.swagger.spec', 'OpenAPI specification') }), safeTranslate(props.t, 'clusterdetails:settings.swagger.description2', '. When enabled, it is accessible via Swagger UI.'), _jsx("br", {}), _jsx("br", {}), (() => {
|
|
570
|
+
const swaggerUrl = buildClusterSwaggerUrl({
|
|
571
|
+
cluster: props.cluster,
|
|
572
|
+
clusterId: props.clusterId,
|
|
573
|
+
stage: runtime.stage,
|
|
574
|
+
});
|
|
575
|
+
if (!swaggerUrl)
|
|
576
|
+
return null;
|
|
577
|
+
return (_jsxs(_Fragment, { children: [safeTranslate(props.t, 'clusterdetails:settings.swagger.accessSwagger', 'Access your cluster Swagger UI:'), ' ', _jsx(Link, { href: swaggerUrl, target: '_blank', rel: 'noopener noreferrer', children: swaggerUrl }), _jsx("br", {}), _jsx("br", {})] }));
|
|
578
|
+
})(), safeTranslate(props.t, 'clusterdetails:settings.swagger.description3', 'Learn more about'), ' ', _jsx(Link, { href: props.docsUrls.swagger, target: '_blank', children: safeTranslate(props.t, 'clusterdetails:settings.swagger.description4', 'accessing API endpoints via Swagger UI.') })] })),
|
|
555
579
|
permissions: {
|
|
556
580
|
mayChange: props.canEditCluster,
|
|
557
581
|
},
|
|
@@ -601,7 +625,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
601
625
|
},
|
|
602
626
|
action: {
|
|
603
627
|
label: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.action.label', 'Upgrade to Tasklist v2'),
|
|
604
|
-
onClick:
|
|
628
|
+
onClick: () => setShowTasklistV2ConfirmModal(true),
|
|
605
629
|
disabled: !props.canEditCluster ||
|
|
606
630
|
isUpdatingTasklistV2 ||
|
|
607
631
|
(props.cluster.externalMetadata?.tasklistV2Enabled ??
|
|
@@ -621,7 +645,14 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
621
645
|
permissions: {
|
|
622
646
|
mayDeleteCluster: props.canDeleteCluster,
|
|
623
647
|
},
|
|
624
|
-
} }),
|
|
648
|
+
} }), showTasklistV2ConfirmModal && (_jsxs(Modal, { open: true, modalHeading: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.modal.heading', 'Upgrade to Tasklist v2'), primaryButtonText: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.modal.confirm', 'Upgrade to Tasklist v2'), secondaryButtonText: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.modal.cancel', 'Cancel'), primaryButtonDisabled: isUpdatingTasklistV2, onRequestClose: () => {
|
|
649
|
+
if (isUpdatingTasklistV2)
|
|
650
|
+
return;
|
|
651
|
+
setShowTasklistV2ConfirmModal(false);
|
|
652
|
+
setTasklistV2UpgradeError(undefined);
|
|
653
|
+
}, onRequestSubmit: () => {
|
|
654
|
+
void submitTasklistV2Upgrade();
|
|
655
|
+
}, size: 'sm', children: [_jsx("p", { children: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.modal.description', 'This action cannot be undone. Once upgraded to Tasklist v2, downgrading back to v1 will not be possible.') }), tasklistV2UpgradeError && (_jsx(InlineNotification, { lowContrast: true, kind: 'error', hideCloseButton: true, title: '', subtitle: tasklistV2UpgradeError }))] })), authorizationsConfirm && (_jsxs(Modal, { open: true, modalHeading: authorizationsConfirmTitle, primaryButtonText: authorizationsConfirmPrimaryText, secondaryButtonText: safeTranslate(props.t, 'clusterdetails:settings.authorizations.modal.buttons.cancel', 'Cancel'), primaryButtonDisabled: isUpdatingRba || isUpdatingIdentityAuthorizations, onRequestClose: () => {
|
|
625
656
|
if (isUpdatingRba || isUpdatingIdentityAuthorizations) {
|
|
626
657
|
return;
|
|
627
658
|
}
|