@camunda/ccma-saas-frontend 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.d.ts +1 -1
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +11 -1
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.js +2 -0
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.types.d.ts +2 -0
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +24 -2
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +9 -0
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.d.ts +1 -1
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +2 -4
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +0 -4
- package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +9 -1
- package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +5 -5
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +3 -3
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.d.ts +1 -1
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.js +2 -2
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.types.d.ts +5 -0
- package/lib/esm/components/c4-convert-trial-organization-modal/c4-convert-trial-organization-modal.js +1 -11
- package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +1 -14
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.d.ts +1 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +188 -71
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +52 -0
- package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +1 -11
- package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js +6 -13
- package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +1 -11
- package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +1 -18
- package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js +1 -11
- package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.d.ts +0 -7
- package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.js +1 -24
- package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +1 -18
- package/lib/esm/components/c4-divider/c4-divider.js +12 -0
- package/lib/esm/components/c4-empty-state/c4-empty-state.d.ts +8 -0
- package/lib/esm/components/c4-empty-state/c4-empty-state.js +32 -8
- package/lib/esm/components/c4-file-uploader/c4-file-uploader.d.ts +36 -0
- package/lib/esm/components/c4-file-uploader/c4-file-uploader.js +43 -0
- package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +1 -11
- package/lib/esm/components/c4-leave-organization-modal/c4-leave-organization-modal.js +1 -11
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.d.ts +10 -0
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.js +96 -0
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.d.ts +22 -0
- package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.js +6 -0
- package/lib/esm/components/c4-rename-organization-modal/c4-rename-organization-modal.js +1 -11
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +50 -0
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +130 -0
- package/lib/esm/externalUrls.const.d.ts +7 -0
- package/lib/esm/externalUrls.const.js +11 -1
- package/lib/esm/i18n/c4-console-i18n.js +3 -0
- package/lib/esm/i18n/en/modals/apiclients.json +2 -1
- package/lib/esm/i18n/en/modals/clusterclients.json +18 -1
- package/lib/esm/i18n/en/pages/clusterdetails.json +12 -7
- package/lib/esm/i18n/en/pages/createcluster.json +43 -0
- package/lib/esm/i18n/en/pages/orgmanagement.json +6 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.js +3 -0
- package/lib/esm/runtime/c4-console-runtime-context.d.ts +1 -1
- package/lib/esm/runtime/c4-console-runtime-context.js +2 -2
- package/lib/esm/runtime/cluster-duplication.d.ts +10 -0
- package/lib/esm/runtime/cluster-duplication.js +15 -0
- package/lib/esm/runtime/org-cluster-defaults.d.ts +14 -0
- package/lib/esm/runtime/org-cluster-defaults.js +19 -0
- package/lib/esm/ui/c4-password-input.js +1 -1
- package/lib/esm/ui/index.d.ts +1 -0
- package/lib/esm/ui/index.js +16 -2
- package/lib/esm/utils/role-labels.d.ts +1 -2
- package/lib/esm/utils/role-labels.js +1 -13
- package/lib/esm/utils/safe-translate.d.ts +4 -2
- package/lib/esm/utils/safe-translate.js +9 -2
- package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +80 -23
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +34 -23
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +6 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +7 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +3 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-activity-tab.js +1 -19
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +1 -14
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +1 -18
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +57 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +77 -28
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +1 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +1 -18
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +12 -22
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +1 -6
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +3 -86
- package/lib/esm/widgets/clusters/c4-clusters-page.js +72 -100
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +7 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -9
- package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +1 -9
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +88 -1
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +285 -45
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +9 -0
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +3 -20
- package/lib/esm/widgets/dashboard/c4-dashboard-app.types.d.ts +6 -0
- package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.js +1 -1
- package/lib/esm/widgets/group-details/c4-group-details-page.js +1 -9
- package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +1 -0
- package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +4 -34
- package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-app.js +99 -23
- package/lib/esm/widgets/management/c4-management-app.types.d.ts +6 -0
- package/lib/esm/widgets/management/c4-management-page.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-page.js +7 -13
- package/lib/esm/widgets/management/c4-management-page.types.d.ts +1 -0
- package/lib/esm/widgets/management/management-tabs.d.ts +1 -1
- package/lib/esm/widgets/management/management-tabs.js +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +1 -13
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -9
- package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.d.ts +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.js +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +1 -13
- package/lib/esm/widgets/management/tabs/c4-management-pricing-tab.js +1 -8
- package/lib/esm/widgets/management/tabs/c4-management-settings-tab.js +1 -24
- package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +1 -13
- package/lib/esm/widgets/user-account/c4-delete-account-widget.js +2 -1
- package/lib/esm/widgets/user-details/c4-user-details-page.js +1 -9
- package/package.json +3 -3
- package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.d.ts +0 -14
- package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.js +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { C4WidgetScope } from '../widgets/c4-widget-scope.types.js';
|
|
2
|
-
export type TranslateFn = (key: string) => string;
|
|
2
|
+
export type TranslateFn = (key: string, options?: Record<string, unknown>) => string;
|
|
3
3
|
/**
|
|
4
4
|
* Key suffix carrying the environment-scoped wording of a copy string. Follows
|
|
5
5
|
* the i18next context convention so both wordings can be translated
|
|
@@ -14,7 +14,9 @@ export declare const ENVIRONMENT_KEY_SUFFIX = "_environment";
|
|
|
14
14
|
* c4 widgets take `t` from the host runtime, which may not have the c4 bundles
|
|
15
15
|
* registered at all, so every lookup needs a built-in English fallback.
|
|
16
16
|
*/
|
|
17
|
-
export declare function safeTranslate(t: TranslateFn | undefined, key: string, fallback: string
|
|
17
|
+
export declare function safeTranslate(t: TranslateFn | undefined, key: string, fallback: string,
|
|
18
|
+
/** Interpolation values for the string, such as `{ email }`. */
|
|
19
|
+
options?: Record<string, unknown>): string;
|
|
18
20
|
/**
|
|
19
21
|
* Resolves a copy string that reads differently per scope: `key` in `'cluster'`
|
|
20
22
|
* scope, `<key>_environment` in `'environment'` scope, each with its own English
|
|
@@ -17,16 +17,23 @@ export const ENVIRONMENT_KEY_SUFFIX = '_environment';
|
|
|
17
17
|
* c4 widgets take `t` from the host runtime, which may not have the c4 bundles
|
|
18
18
|
* registered at all, so every lookup needs a built-in English fallback.
|
|
19
19
|
*/
|
|
20
|
-
export function safeTranslate(t, key, fallback
|
|
20
|
+
export function safeTranslate(t, key, fallback,
|
|
21
|
+
/** Interpolation values for the string, such as `{ email }`. */
|
|
22
|
+
options) {
|
|
21
23
|
if (!t)
|
|
22
24
|
return fallback;
|
|
23
25
|
let translated;
|
|
24
26
|
try {
|
|
25
|
-
translated = t(key);
|
|
27
|
+
translated = t(key, options);
|
|
26
28
|
}
|
|
27
29
|
catch {
|
|
28
30
|
return fallback;
|
|
29
31
|
}
|
|
32
|
+
// A host can answer with something that is not a string. The type says it
|
|
33
|
+
// cannot, thus only a host that breaks the type gets here.
|
|
34
|
+
if (typeof translated !== 'string') {
|
|
35
|
+
return fallback;
|
|
36
|
+
}
|
|
30
37
|
if (!translated || translated === key) {
|
|
31
38
|
return fallback;
|
|
32
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ConsoleClusterClientsService, ConsoleClusterService, } from '@camunda/ccma-api';
|
|
3
3
|
import { checkVersion, IDENTITY_MANAGEMENT_MIN_VERSION, REST_API_URL_TRANSFORM_MIN_VERSION, REST_API_V2_MIN_VERSION, VersionCheckOperator, ZEEBE_REST_URL_MIN_VERSION, } from '@camunda/ccma-shared-types';
|
|
4
4
|
import { observer } from 'mobx-react-lite';
|
|
@@ -11,17 +11,7 @@ import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
|
11
11
|
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
12
12
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
13
13
|
import { BreadcrumbSkeleton, CodeSnippet, Modal, Stack, TextInput, } from '../../ui/index.js';
|
|
14
|
-
|
|
15
|
-
if (!t)
|
|
16
|
-
return fallback;
|
|
17
|
-
try {
|
|
18
|
-
const translated = t(key);
|
|
19
|
-
return translated && translated !== key ? translated : fallback;
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return fallback;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
14
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
25
15
|
function joinUrl(baseUrl, path) {
|
|
26
16
|
const base = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
|
|
27
17
|
const nextPath = path.startsWith('/') ? path : `/${path}`;
|
|
@@ -62,7 +52,7 @@ function toListFormat(values) {
|
|
|
62
52
|
function validateClientName(opts) {
|
|
63
53
|
const { value, clients, currentClientUuid, t } = opts;
|
|
64
54
|
if (!value) {
|
|
65
|
-
return safeTranslate(t, 'clusterclients:update.fields.name.required', 'Client
|
|
55
|
+
return safeTranslate(t, 'clusterclients:update.fields.name.required', 'Client name is required');
|
|
66
56
|
}
|
|
67
57
|
const isAllowed = /^[A-Za-z0-9_-]+$/.test(value);
|
|
68
58
|
if (!isAllowed) {
|
|
@@ -81,6 +71,11 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
81
71
|
const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
|
|
82
72
|
const authz = useC4ConsoleAuthz({ orgId: props.orgId });
|
|
83
73
|
const canMutateCluster = Boolean(authz.visibilities.clusters?.canEdit);
|
|
74
|
+
// The rotate route asks for `cluster.clients.create`, the permission of a
|
|
75
|
+
// creation, because its answer carries a usable credential. A member can
|
|
76
|
+
// hold `clusters.canEdit` without it, thus the menu must not show an
|
|
77
|
+
// action that the backend answers with 403.
|
|
78
|
+
const canCreateClusterClients = Boolean(authz.orgPermissions?.cluster.clients.create);
|
|
84
79
|
const [cluster, setCluster] = useState(undefined);
|
|
85
80
|
const [clusterLoading, setClusterLoading] = useState(true);
|
|
86
81
|
const [clusterError, setClusterError] = useState('');
|
|
@@ -344,9 +339,17 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
344
339
|
return rows;
|
|
345
340
|
}, [client, cluster, oauthTokenUrl, props.clusterId, t]);
|
|
346
341
|
// -----------------------------
|
|
347
|
-
// Rename/Delete modals
|
|
342
|
+
// Rename/Rotate/Delete modals
|
|
348
343
|
// -----------------------------
|
|
349
344
|
const [renameOpen, setRenameOpen] = useState(false);
|
|
345
|
+
const [rotateOpen, setRotateOpen] = useState(false);
|
|
346
|
+
/**
|
|
347
|
+
* The new secret, with the client id that it belongs to. Console shows a
|
|
348
|
+
* secret one time, thus this state must not depend on the list of clients:
|
|
349
|
+
* a reload that fails erases the list, and the customer would lose the
|
|
350
|
+
* only copy of the secret with it.
|
|
351
|
+
*/
|
|
352
|
+
const [rotatedSecret, setRotatedSecret] = useState(undefined);
|
|
350
353
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
351
354
|
const [mutationBusy, setMutationBusy] = useState(false);
|
|
352
355
|
const [mutationError, setMutationError] = useState('');
|
|
@@ -364,6 +367,11 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
364
367
|
setMutationError('');
|
|
365
368
|
}
|
|
366
369
|
}, [deleteOpen]);
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
if (rotateOpen) {
|
|
372
|
+
setMutationError('');
|
|
373
|
+
}
|
|
374
|
+
}, [rotateOpen]);
|
|
367
375
|
const clientNameValidationMessage = useMemo(() => {
|
|
368
376
|
if (!renameOpen) {
|
|
369
377
|
return undefined;
|
|
@@ -423,6 +431,40 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
423
431
|
setMutationBusy(false);
|
|
424
432
|
}
|
|
425
433
|
}, [apiConfig, client, clientName, clients, loadClients, props, t]);
|
|
434
|
+
const onSubmitRotate = useCallback(async () => {
|
|
435
|
+
if (!client) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
setMutationBusy(true);
|
|
439
|
+
setMutationError('');
|
|
440
|
+
try {
|
|
441
|
+
const response = await ConsoleClusterClientsService.rotateSecret({
|
|
442
|
+
config: apiConfig,
|
|
443
|
+
params: {
|
|
444
|
+
orgId: props.orgId,
|
|
445
|
+
clusterId: props.clusterId,
|
|
446
|
+
clientUuid: client.uuid,
|
|
447
|
+
},
|
|
448
|
+
});
|
|
449
|
+
setRotateOpen(false);
|
|
450
|
+
// Console shows the secret one time. The customer reads it from the
|
|
451
|
+
// modal that opens now.
|
|
452
|
+
setRotatedSecret({
|
|
453
|
+
clientId: client.clientId,
|
|
454
|
+
secret: response.clientSecret,
|
|
455
|
+
});
|
|
456
|
+
// Reload in the background. The modal must not wait for it, and must
|
|
457
|
+
// stay open if it fails.
|
|
458
|
+
void loadClients();
|
|
459
|
+
}
|
|
460
|
+
catch (err) {
|
|
461
|
+
console.error('Failed to rotate client secret:', err);
|
|
462
|
+
setMutationError(safeTranslate(t, 'clusterclients:rotate.error.generic', 'Failed to rotate the client secret.'));
|
|
463
|
+
}
|
|
464
|
+
finally {
|
|
465
|
+
setMutationBusy(false);
|
|
466
|
+
}
|
|
467
|
+
}, [apiConfig, client, loadClients, props.clusterId, props.orgId, t]);
|
|
426
468
|
const onSubmitDelete = useCallback(async () => {
|
|
427
469
|
if (!client) {
|
|
428
470
|
return;
|
|
@@ -458,17 +500,21 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
458
500
|
// -----------------------------
|
|
459
501
|
// Render
|
|
460
502
|
// -----------------------------
|
|
503
|
+
// Console shows a new secret one time, thus this modal stays on each
|
|
504
|
+
// branch below. A reload of the clients that fails leaves this page with
|
|
505
|
+
// no client, and the customer must still read the secret.
|
|
506
|
+
const rotatedSecretModal = rotatedSecret ? (_jsx(Modal, { open: true, size: 'sm', passiveModal: true, modalHeading: safeTranslate(t, 'clusterclients:rotate.result.heading', 'New client secret'), onRequestClose: () => setRotatedSecret(undefined), children: _jsxs(Stack, { gap: 5, children: [_jsx(C4InlineNotification, { kind: 'warning', lowContrast: true, hideCloseButton: true, title: safeTranslate(t, 'clusterclients:create.warning', 'The client secret will not be shown again.'), style: { maxInlineSize: '100%' } }), _jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: safeTranslate(t, 'clusterdetails:clients.details.clientId', 'Client Id') }), _jsx(CodeSnippet, { type: 'single', children: rotatedSecret.clientId })] }), _jsxs(Stack, { gap: 2, children: [_jsx("strong", { children: safeTranslate(t, 'clusterdetails:clients.details.clientSecret', 'Client Secret') }), _jsx(CodeSnippet, { type: 'single', children: rotatedSecret.secret })] })] }) })) : null;
|
|
461
507
|
if (clusterLoading || clientsLoading) {
|
|
462
|
-
return (_jsx(Stack, { gap: 4, children: _jsx("div", { style: {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
508
|
+
return (_jsxs(_Fragment, { children: [_jsx(Stack, { gap: 4, children: _jsx("div", { style: {
|
|
509
|
+
minHeight: '40px',
|
|
510
|
+
display: 'grid',
|
|
511
|
+
gridAutoFlow: 'column',
|
|
512
|
+
gridAutoColumns: 'max-content',
|
|
513
|
+
alignItems: 'center',
|
|
514
|
+
}, children: _jsx(BreadcrumbSkeleton, {}) }) }), rotatedSecretModal] }));
|
|
469
515
|
}
|
|
470
516
|
if (!client) {
|
|
471
|
-
return _jsx(_Fragment, {});
|
|
517
|
+
return _jsx(_Fragment, { children: rotatedSecretModal });
|
|
472
518
|
}
|
|
473
519
|
const menuItems = canMutateCluster
|
|
474
520
|
? [
|
|
@@ -477,6 +523,15 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
477
523
|
label: safeTranslate(t, 'clusterclients:update.heading', 'Rename'),
|
|
478
524
|
onClick: () => setRenameOpen(true),
|
|
479
525
|
},
|
|
526
|
+
...(canCreateClusterClients
|
|
527
|
+
? [
|
|
528
|
+
{
|
|
529
|
+
key: 'RotateSecret',
|
|
530
|
+
label: safeTranslate(t, 'clusterdetails:clients.overflowMenu.rotateSecret', 'Rotate secret'),
|
|
531
|
+
onClick: () => setRotateOpen(true),
|
|
532
|
+
},
|
|
533
|
+
]
|
|
534
|
+
: []),
|
|
480
535
|
{
|
|
481
536
|
key: 'Delete',
|
|
482
537
|
label: safeTranslate(t, 'clusterclients:delete.heading', 'Delete'),
|
|
@@ -515,7 +570,9 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
515
570
|
void onSubmitRename();
|
|
516
571
|
}, primaryButtonDisabled: !canSubmitRename, children: _jsxs(Stack, { gap: 5, children: [mutationError && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, title: safeTranslate(t, 'common:error', 'Error'), subtitle: mutationError })), _jsx(TextInput, { id: 'clusterClientName-update', "data-modal-primary-focus": true, labelText: safeTranslate(t, 'clusterclients:update.fields.name.label', 'Name'), maxLength: 50, value: clientName, placeholder: safeTranslate(t, 'clusterclients:update.fields.name.label', 'Name'), helperText: safeTranslate(t, 'clusterclients:update.fields.name.helperText', 'can contain letters, dashes, underscores, and digits'), invalid: Boolean(clientNameValidationMessage), invalidText: clientNameValidationMessage ?? '', onChange: (event) => {
|
|
517
572
|
setClientName(event.target.value);
|
|
518
|
-
}, onBlur: () => setClientNameTouched(true) })] }) })),
|
|
573
|
+
}, onBlur: () => setClientNameTouched(true) })] }) })), rotateOpen && (_jsx(Modal, { open: true, size: 'sm', danger: true, modalHeading: safeTranslate(t, 'clusterclients:rotate.heading', 'Rotate client secret'), primaryButtonText: safeTranslate(t, 'clusterclients:rotate.buttons.primary', 'Rotate secret'), secondaryButtonText: safeTranslate(t, 'clusterclients:rotate.buttons.secondary', 'Cancel'), onRequestClose: () => mutationBusy ? undefined : setRotateOpen(false), onRequestSubmit: () => {
|
|
574
|
+
void onSubmitRotate();
|
|
575
|
+
}, primaryButtonDisabled: mutationBusy, children: _jsxs(Stack, { gap: 5, children: [mutationError && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, title: safeTranslate(t, 'common:error', 'Error'), subtitle: mutationError })), _jsx("p", { children: safeTranslate(t, 'clusterclients:rotate.description', 'This creates a new secret for this client. The current secret stops working, so update every application that uses it. The change can take a few minutes to apply everywhere.') })] }) })), rotatedSecretModal, deleteOpen && (_jsx(Modal, { open: true, size: 'sm', danger: true, modalHeading: safeTranslate(t, 'clusterclients:delete.heading', 'Delete client'), primaryButtonText: safeTranslate(t, 'clusterclients:delete.buttons.primary', 'Delete'), secondaryButtonText: safeTranslate(t, 'clusterclients:delete.buttons.secondary', 'Cancel'), onRequestClose: () => mutationBusy ? undefined : setDeleteOpen(false), onRequestSubmit: () => {
|
|
519
576
|
void onSubmitDelete();
|
|
520
577
|
}, primaryButtonDisabled: mutationBusy, children: _jsxs(Stack, { gap: 5, children: [mutationError && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, title: safeTranslate(t, 'common:error', 'Error'), subtitle: mutationError })), _jsx("p", { children: safeTranslate(t, 'clusterclients:delete.description', 'Deleting this client will revoke access for any integrations using these credentials.') })] }) }))] }));
|
|
521
578
|
});
|
|
@@ -10,11 +10,14 @@ import { observer } from 'mobx-react-lite';
|
|
|
10
10
|
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
11
11
|
import { normalizeClusterStatus } from '../../components/c4-cluster-overview/applications.js';
|
|
12
12
|
import { getC4ClusterDetailsUrls } from '../../externalUrls.const.js';
|
|
13
|
-
import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
13
|
+
import { isDeveloperBlockedFromClusterCreate, useC4ConsoleAuthz, } from '../../runtime/c4-console-authz.js';
|
|
14
14
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
15
|
-
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
15
|
+
import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
|
|
16
|
+
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-blocked.js';
|
|
17
|
+
import { CLUSTER_DUPLICATION_FLAG } from '../../runtime/cluster-duplication.js';
|
|
16
18
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
17
19
|
import { Modal, Stack, TextInput } from '../../ui/index.js';
|
|
20
|
+
import { safeTranslate } from '../../utils/safe-translate.js';
|
|
18
21
|
import { clusterHealthOverride } from '../cluster-health-override.js';
|
|
19
22
|
import { useClusterApiClients } from '../environment/use-cluster-api-clients.js';
|
|
20
23
|
import { useClusterVersionFlags } from '../environment/use-cluster-version-flags.js';
|
|
@@ -32,26 +35,6 @@ import { C4ClusterDetailsIpWhitelistTab } from './tabs/c4-cluster-details-ip-whi
|
|
|
32
35
|
import { C4ClusterDetailsOverviewTab } from './tabs/c4-cluster-details-overview-tab.js';
|
|
33
36
|
import { C4ClusterDetailsSecureConnectivityTab } from './tabs/c4-cluster-details-secure-connectivity-tab.js';
|
|
34
37
|
import { C4ClusterDetailsSettingsTab } from './tabs/c4-cluster-details-settings-tab.js';
|
|
35
|
-
function safeTranslate(t, key, fallback, options) {
|
|
36
|
-
try {
|
|
37
|
-
const translated = t?.(key, options);
|
|
38
|
-
if (!translated || translated === key) {
|
|
39
|
-
return fallback;
|
|
40
|
-
}
|
|
41
|
-
// i18next can return the key *without* the namespace when the namespace is missing.
|
|
42
|
-
// Example: `c4console:clusterDetails.tabs.overview` -> `clusterDetails.tabs.overview`
|
|
43
|
-
if (key.includes(':')) {
|
|
44
|
-
const withoutNamespace = key.split(':').slice(1).join(':');
|
|
45
|
-
if (translated === withoutNamespace) {
|
|
46
|
-
return fallback;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return translated;
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return fallback;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
38
|
function renderInlineStrong(value) {
|
|
56
39
|
const match = value.match(/^(.*)<strong>(.*)<\/strong>(.*)$/);
|
|
57
40
|
if (!match)
|
|
@@ -305,6 +288,8 @@ function isUnsupportedGenerationStarted(isUnsupportedStarting) {
|
|
|
305
288
|
}
|
|
306
289
|
export const C4ClusterDetailsApp = observer((props) => {
|
|
307
290
|
const runtime = useC4ConsoleRuntime();
|
|
291
|
+
const clusterDuplicationEnabled = useC4FeatureFlag(CLUSTER_DUPLICATION_FLAG);
|
|
292
|
+
const clusterCreationBlocked = useC4FeatureFlag(CLUSTER_CREATION_BLOCKED_FLAG);
|
|
308
293
|
const data = useC4ConsoleData();
|
|
309
294
|
const t = runtime.i18n?.t;
|
|
310
295
|
const urls = useMemo(() => getC4ClusterDetailsUrls(props.urls), [props.urls]);
|
|
@@ -1035,6 +1020,24 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1035
1020
|
const ignoreGracePeriod = Boolean(orgInfo?.organizationToSalesPlan?.limits?.ignoreGracePeriod);
|
|
1036
1021
|
const clusterPlanTypeReservations = orgInfo?.organizationToSalesPlan
|
|
1037
1022
|
?.clusterPlanTypesToReserved;
|
|
1023
|
+
// A duplicate makes a cluster, thus it needs the create permission and not
|
|
1024
|
+
// the edit permission of this cluster. The three guards after it mirror the
|
|
1025
|
+
// ones of the cluster list and of console-backend, so that this menu offers
|
|
1026
|
+
// nothing that the endpoint refuses:
|
|
1027
|
+
// - `developerNoClusterCreate` makes `developerClusterCreateValidator`
|
|
1028
|
+
// answer 403 for a developer of that org.
|
|
1029
|
+
// - A cluster that was failed over is suspended, and the duplicate route
|
|
1030
|
+
// answers 409 for it.
|
|
1031
|
+
const developerBlockedFromClusterCreate = isDeveloperBlockedFromClusterCreate({
|
|
1032
|
+
developerNoClusterCreateLimit: orgInfo?.organizationToSalesPlan?.limits?.developerNoClusterCreate ===
|
|
1033
|
+
true,
|
|
1034
|
+
orgRoles: authz.orgRoles,
|
|
1035
|
+
});
|
|
1036
|
+
const canDuplicate = Boolean(authz.visibilities.clusters?.canCreate) &&
|
|
1037
|
+
clusterDuplicationEnabled &&
|
|
1038
|
+
!clusterCreationBlocked &&
|
|
1039
|
+
!developerBlockedFromClusterCreate &&
|
|
1040
|
+
cluster?.isFailoverSource !== true;
|
|
1038
1041
|
// -----------------------------
|
|
1039
1042
|
// Tabs
|
|
1040
1043
|
// -----------------------------
|
|
@@ -1242,7 +1245,7 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1242
1245
|
canRead: Boolean(orgPermissions?.cluster.connectorSecrets.read),
|
|
1243
1246
|
canUpdate: Boolean(orgPermissions?.cluster.connectorSecrets.update),
|
|
1244
1247
|
canDelete: Boolean(orgPermissions?.cluster.connectorSecrets.delete),
|
|
1245
|
-
}, docsUrl: urls.docs.connectorSecrets, t: t, onNavigate: props.onNavigate }));
|
|
1248
|
+
}, docsUrl: urls.docs.connectorSecrets, clusterSecretsDocsUrl: urls.docs.clusterSecrets, t: t, onNavigate: props.onNavigate }));
|
|
1246
1249
|
const hotBackupsComponent = (_jsx(C4ClusterDetailsHotBackupsTab, { cluster: cluster, orgId: props.orgId, clusterId: props.clusterId, apiConfig: apiConfig, canMutateCluster: canMutateCluster, isHotBackupEnabled: Boolean(orgInfo?.organizationToSalesPlan?.limits?.hotBackup), manualBackupRetainedCount: orgInfo?.organizationToSalesPlan?.limits?.hotBackupManualRetainedCount, scheduledBackupRetainedCount: orgInfo?.organizationToSalesPlan?.limits
|
|
1247
1250
|
?.hotBackupScheduledRetainedCount, docsUrls: {
|
|
1248
1251
|
hotBackups: urls.docs.hotBackups,
|
|
@@ -1540,8 +1543,16 @@ export const C4ClusterDetailsApp = observer((props) => {
|
|
|
1540
1543
|
return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsPage, { loading: isClusterLoading || authz.isLoading, padding: props.padding, clusterName: cluster?.name, phaseTag: headerPhaseTag, healthStatus: headerHealthStatus, versionLabel: headerVersionLabel, isDevelopmentPlan: cluster?.planType?.development, urls: { clusters: urls.clusters }, onNavigateToClusters: () => props.onNavigate?.({ kind: 'clusters', orgId: props.orgId }), menu: {
|
|
1541
1544
|
canRename,
|
|
1542
1545
|
canDelete,
|
|
1546
|
+
canDuplicate,
|
|
1543
1547
|
onRename: canRename ? () => setRenameOpen(true) : undefined,
|
|
1544
1548
|
onDelete: canDelete ? () => setDeleteOpen(true) : undefined,
|
|
1549
|
+
onDuplicate: canDuplicate
|
|
1550
|
+
? () => props.onNavigate?.({
|
|
1551
|
+
kind: 'duplicateCluster',
|
|
1552
|
+
orgId: props.orgId,
|
|
1553
|
+
clusterId: props.clusterId,
|
|
1554
|
+
})
|
|
1555
|
+
: undefined,
|
|
1545
1556
|
}, banner: banner, secondaryReplicationNotReady: secondaryReplicationNotReady, onGoToEncryptionTab: () => handleTabChange('encryption'), tabs: {
|
|
1546
1557
|
list: tabs,
|
|
1547
1558
|
desiredTabId: activeTabId,
|
|
@@ -8,6 +8,10 @@ export type C4ClusterDetailsNavigateEvent = {
|
|
|
8
8
|
} | {
|
|
9
9
|
kind: 'clusters';
|
|
10
10
|
orgId: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'duplicateCluster';
|
|
13
|
+
orgId: string;
|
|
14
|
+
clusterId: string;
|
|
11
15
|
} | {
|
|
12
16
|
kind: 'dashboard';
|
|
13
17
|
orgId: string;
|
|
@@ -78,6 +82,7 @@ export interface C4ClusterDetailsDocsUrls {
|
|
|
78
82
|
ipWhitelist: string;
|
|
79
83
|
clients: string;
|
|
80
84
|
connectorSecrets: string;
|
|
85
|
+
clusterSecrets: string;
|
|
81
86
|
mcpSetup: string;
|
|
82
87
|
upgrade: C4ClusterDetailsUpgradeDocsUrls;
|
|
83
88
|
byom: string;
|
|
@@ -110,6 +115,7 @@ export interface C4ClusterDetailsUrls {
|
|
|
110
115
|
ipWhitelist?: string;
|
|
111
116
|
clients?: string;
|
|
112
117
|
connectorSecrets?: string;
|
|
118
|
+
clusterSecrets?: string;
|
|
113
119
|
mcpSetup?: string;
|
|
114
120
|
upgrade?: Partial<C4ClusterDetailsUpgradeDocsUrls>;
|
|
115
121
|
byom?: string;
|
|
@@ -55,6 +55,13 @@ function buildMenuItems(opts) {
|
|
|
55
55
|
label: safeTranslate(t, 'c4console:clusterDetails.menu.rename', 'Rename'),
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
if (menu.canDuplicate && menu.onDuplicate) {
|
|
59
|
+
items.push({
|
|
60
|
+
key: 'clusterDuplicateOperation',
|
|
61
|
+
onClick: menu.onDuplicate,
|
|
62
|
+
label: safeTranslate(t, 'c4console:clusterDetails.menu.duplicate', 'Duplicate'),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
58
65
|
if (menu.canDelete && menu.onDelete) {
|
|
59
66
|
items.push({
|
|
60
67
|
key: 'clusterDeleteOperation',
|
|
@@ -44,8 +44,11 @@ export interface C4ClusterDetailsPageProps {
|
|
|
44
44
|
menu?: {
|
|
45
45
|
canRename: boolean;
|
|
46
46
|
canDelete: boolean;
|
|
47
|
+
/** Gated by the `console.clusterDuplication` flag and by the create permission. */
|
|
48
|
+
canDuplicate?: boolean;
|
|
47
49
|
onRename?: () => void;
|
|
48
50
|
onDelete?: () => void;
|
|
51
|
+
onDuplicate?: () => void;
|
|
49
52
|
};
|
|
50
53
|
banner?: C4ClusterDetailsPageBanner;
|
|
51
54
|
/**
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { C4ClusterDetailsActivity } from '../../../components/c4-cluster-details-activity/c4-cluster-details-activity.js';
|
|
3
|
-
|
|
4
|
-
try {
|
|
5
|
-
const translated = t?.(key);
|
|
6
|
-
if (!translated || translated === key) {
|
|
7
|
-
return fallback;
|
|
8
|
-
}
|
|
9
|
-
// i18next can return the key *without* the namespace when the namespace is missing.
|
|
10
|
-
if (key.includes(':')) {
|
|
11
|
-
const withoutNamespace = key.split(':').slice(1).join(':');
|
|
12
|
-
if (translated === withoutNamespace) {
|
|
13
|
-
return fallback;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return translated;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return fallback;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
3
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
22
4
|
export const C4ClusterDetailsActivityTab = (props) => {
|
|
23
5
|
return (_jsx(C4ClusterDetailsActivity, { activityGroups: props.activityGroups, isLoading: props.isLoading, hasError: props.hasError, text: {
|
|
24
6
|
today: safeTranslate(props.t, 'clusterdetails:activity.today', 'Today'),
|
|
@@ -12,20 +12,7 @@ import { C4InlineNotification } from '../../../components/c4-inline-notification
|
|
|
12
12
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
13
13
|
import { Checkbox, Form, Link, Modal, PasswordInput, Stack, TextInput, } from '../../../ui/index.js';
|
|
14
14
|
import { useRadioFamily } from '../../../ui/families.js';
|
|
15
|
-
|
|
16
|
-
function safeTranslate(translateFn, key, fallback, options) {
|
|
17
|
-
try {
|
|
18
|
-
const result = translateFn(key, options);
|
|
19
|
-
// If i18next returns the key unchanged, use fallback
|
|
20
|
-
if (result === key) {
|
|
21
|
-
return fallback;
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return fallback;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
15
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
29
16
|
export function resolveUpdatedAlertHmacSecret(params) {
|
|
30
17
|
const { reportType, wantsHmac, hadHmacOnOpen, hmacSecret } = params;
|
|
31
18
|
if (reportType !== 'Webhook') {
|
|
@@ -7,25 +7,8 @@ import { C4ClusterByomClients } from '../../../components/c4-cluster-byom-client
|
|
|
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
9
|
import { Button, CodeSnippet, Modal, Stack, TextInput } from '../../../ui/index.js';
|
|
10
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
10
11
|
import { SECTION_HEADING_STYLE } from '../../../utils/section-heading-style.js';
|
|
11
|
-
// Helper function to ensure translations work
|
|
12
|
-
function safeTranslate(t, key, fallback) {
|
|
13
|
-
if (!t)
|
|
14
|
-
return fallback;
|
|
15
|
-
const result = t(key);
|
|
16
|
-
if (!result || result === key) {
|
|
17
|
-
return fallback;
|
|
18
|
-
}
|
|
19
|
-
// i18next can return the key *without* the namespace when the namespace is missing.
|
|
20
|
-
// Example: `clusterdetails:byomClients.noClientsMessage.title` -> `byomClients.noClientsMessage.title`
|
|
21
|
-
if (key.includes(':')) {
|
|
22
|
-
const withoutNamespace = key.split(':').slice(1).join(':');
|
|
23
|
-
if (result === withoutNamespace) {
|
|
24
|
-
return fallback;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
12
|
function asByomStatusLike(value) {
|
|
30
13
|
if (!value || typeof value !== 'object')
|
|
31
14
|
return undefined;
|
|
@@ -80,6 +80,7 @@ export const C4ClusterDetailsClientsTab = (props) => {
|
|
|
80
80
|
// Client modals state
|
|
81
81
|
const [createClientOpen, setCreateClientOpen] = useState(false);
|
|
82
82
|
const [updateClientOpen, setUpdateClientOpen] = useState(false);
|
|
83
|
+
const [rotateSecretOpen, setRotateSecretOpen] = useState(false);
|
|
83
84
|
const [deleteClientOpen, setDeleteClientOpen] = useState(false);
|
|
84
85
|
const [clientMutationBusy, setClientMutationBusy] = useState(false);
|
|
85
86
|
const [clientMutationError, setClientMutationError] = useState('');
|
|
@@ -92,7 +93,7 @@ export const C4ClusterDetailsClientsTab = (props) => {
|
|
|
92
93
|
const [clientCreatedScopes, setClientCreatedScopes] = useState([]);
|
|
93
94
|
const validateClientName = useCallback((value) => {
|
|
94
95
|
if (!value) {
|
|
95
|
-
return 'Client
|
|
96
|
+
return safeTranslate(t, 'clusterclients:update.fields.name.required', 'Client name is required');
|
|
96
97
|
}
|
|
97
98
|
const isAllowed = /^[A-Za-z0-9_-]+$/.test(value);
|
|
98
99
|
if (!isAllowed) {
|
|
@@ -153,6 +154,7 @@ export const C4ClusterDetailsClientsTab = (props) => {
|
|
|
153
154
|
headerCreated: safeTranslate(t, 'clusterdetails:clients.header.created', 'Created'),
|
|
154
155
|
headerLastUsed: safeTranslate(t, 'clusterdetails:clients.header.lastUsed', 'Last Used'),
|
|
155
156
|
renameAction: safeTranslate(t, 'clusterdetails:clients.overflowMenu.rename', 'Rename'),
|
|
157
|
+
rotateSecretAction: safeTranslate(t, 'clusterdetails:clients.overflowMenu.rotateSecret', 'Rotate secret'),
|
|
156
158
|
deleteAction: safeTranslate(t, 'clusterdetails:clients.overflowMenu.delete', 'Delete'),
|
|
157
159
|
errorTitle: safeTranslate(t, 'clusterdetails:clients.fetchError.title', 'Oops ... something went wrong.'),
|
|
158
160
|
errorDescription: safeTranslate(t, 'clusterdetails:clients.fetchError.description', 'Please try reloading!'),
|
|
@@ -199,6 +201,12 @@ export const C4ClusterDetailsClientsTab = (props) => {
|
|
|
199
201
|
setClientName(found?.name ?? '');
|
|
200
202
|
setClientMutationError('');
|
|
201
203
|
setUpdateClientOpen(true);
|
|
204
|
+
}, onRotateClientSecret: (clientId) => {
|
|
205
|
+
const found = clients.find((c) => c.uuid === clientId);
|
|
206
|
+
trackEvent('apiClients:rotateSecret:open', 'Open Rotate Api Client Secret Modal', { clientId: found?.clientId ?? clientId });
|
|
207
|
+
setSelectedClientId(clientId);
|
|
208
|
+
setClientMutationError('');
|
|
209
|
+
setRotateSecretOpen(true);
|
|
202
210
|
}, onDeleteClient: (clientId) => {
|
|
203
211
|
const found = clients.find((c) => c.uuid === clientId);
|
|
204
212
|
trackEvent('apiClients:delete:open', 'Open Delete Api Client Modal', {
|
|
@@ -857,7 +865,54 @@ export const C4ClusterDetailsClientsTab = (props) => {
|
|
|
857
865
|
setClientMutationBusy(false);
|
|
858
866
|
}
|
|
859
867
|
})();
|
|
860
|
-
}, children: _jsxs(Stack, { gap: 4, children: [clientMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: safeTranslate(t, 'clusterclients:update.error.title', 'Error'), subtitle: clientMutationError, hideCloseButton: true, lowContrast: true })), _jsx(TextInput, { id: 'client-update-name', labelText: 'Name', value: clientName, onChange: (event) => setClientName(event.target.value) })] }) }), _jsx(Modal, { open:
|
|
868
|
+
}, children: _jsxs(Stack, { gap: 4, children: [clientMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: safeTranslate(t, 'clusterclients:update.error.title', 'Error'), subtitle: clientMutationError, hideCloseButton: true, lowContrast: true })), _jsx(TextInput, { id: 'client-update-name', labelText: 'Name', value: clientName, onChange: (event) => setClientName(event.target.value) })] }) }), _jsx(Modal, { open: rotateSecretOpen, danger: true, modalHeading: safeTranslate(t, 'clusterclients:rotate.heading', 'Rotate client secret'), primaryButtonText: safeTranslate(t, 'clusterclients:rotate.buttons.primary', 'Rotate secret'), secondaryButtonText: safeTranslate(t, 'clusterclients:rotate.buttons.secondary', 'Cancel'), primaryButtonDisabled: clientMutationBusy, onRequestClose: () => {
|
|
869
|
+
// A close during the request would hide the error that the failed
|
|
870
|
+
// rotation writes into this modal.
|
|
871
|
+
if (clientMutationBusy) {
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
trackEvent('apiClients:rotateSecret:cancel', 'Cancel Rotate Api Client Secret Modal');
|
|
875
|
+
setRotateSecretOpen(false);
|
|
876
|
+
}, onRequestSubmit: () => {
|
|
877
|
+
void (async () => {
|
|
878
|
+
const client = clients.find((c) => c.uuid === selectedClientId);
|
|
879
|
+
setClientMutationBusy(true);
|
|
880
|
+
setClientMutationError('');
|
|
881
|
+
try {
|
|
882
|
+
trackEvent('apiClients:rotateSecret:confirm', 'Confirm Rotate Api Client Secret Modal', { clientId: client?.clientId ?? selectedClientId });
|
|
883
|
+
const response = await ConsoleClusterClientsService.rotateSecret({
|
|
884
|
+
config: apiConfig,
|
|
885
|
+
params: {
|
|
886
|
+
orgId,
|
|
887
|
+
clusterId,
|
|
888
|
+
clientUuid: selectedClientId,
|
|
889
|
+
},
|
|
890
|
+
});
|
|
891
|
+
setRotateSecretOpen(false);
|
|
892
|
+
// The same modal as after a creation: the new secret is shown
|
|
893
|
+
// one time, in every format that the customer can copy.
|
|
894
|
+
setClientCreateResponse(response);
|
|
895
|
+
setClientCreatedName(client?.name ?? '');
|
|
896
|
+
setClientCreatedScopes(hasIdentityIntegration
|
|
897
|
+
? mapScopesForDisplay(client?.permissions ?? [])
|
|
898
|
+
: (client?.permissions ?? []));
|
|
899
|
+
// Reload in background; keep the credentials modal responsive.
|
|
900
|
+
void onReloadClients();
|
|
901
|
+
}
|
|
902
|
+
catch (error) {
|
|
903
|
+
runtime.telemetry?.captureException?.(error, {
|
|
904
|
+
widget: 'C4ClusterDetailsClientsTab',
|
|
905
|
+
eventName: 'apiClients:rotateSecret:confirm',
|
|
906
|
+
orgId,
|
|
907
|
+
clusterId,
|
|
908
|
+
});
|
|
909
|
+
setClientMutationError(error instanceof Error ? error.message : 'Failed');
|
|
910
|
+
}
|
|
911
|
+
finally {
|
|
912
|
+
setClientMutationBusy(false);
|
|
913
|
+
}
|
|
914
|
+
})();
|
|
915
|
+
}, children: _jsxs(Stack, { gap: 4, children: [clientMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: safeTranslate(t, 'clusterclients:rotate.error.title', 'Error'), subtitle: clientMutationError, hideCloseButton: true, lowContrast: true })), _jsx("p", { children: safeTranslate(t, 'clusterclients:rotate.description', 'This creates a new secret for this client. The current secret stops working, so update every application that uses it. The change can take a few minutes to apply everywhere.') })] }) }), _jsx(Modal, { open: deleteClientOpen, danger: true, modalHeading: 'Delete API client', primaryButtonText: 'Delete', secondaryButtonText: 'Cancel', primaryButtonDisabled: clientMutationBusy, onRequestClose: () => {
|
|
861
916
|
trackEvent('apiClients:delete:cancel', 'Cancel Delete Api Client Modal');
|
|
862
917
|
setDeleteClientOpen(false);
|
|
863
918
|
}, onRequestSubmit: () => {
|