@camunda/ccma-saas-frontend 0.12.0 → 0.13.1
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-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-clusters-empty-state/c4-clusters-empty-state.d.ts +7 -0
- package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +10 -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-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-segmented-control/c4-segmented-control.d.ts +4 -0
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +14 -1
- package/lib/esm/i18n/en/modals/clusterclients.json +16 -0
- package/lib/esm/i18n/en/pages/clusterdetails.json +1 -6
- package/lib/esm/i18n/en/pages/createcluster.json +1 -1
- package/lib/esm/i18n/en/pages/orgmanagement.json +3 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +1 -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/org-cluster-defaults.d.ts +14 -0
- package/lib/esm/runtime/org-cluster-defaults.js +19 -0
- package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +78 -11
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +56 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +11 -3
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +2 -70
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +1 -1
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +2 -2
- package/lib/esm/widgets/dashboard/c4-dashboard-app.types.d.ts +6 -0
- package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-app.js +98 -3
- 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 +6 -4
- 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-cluster-defaults-tab.d.ts +5 -0
- package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.js +5 -0
- 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,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';
|
|
@@ -71,6 +71,11 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
71
71
|
const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
|
|
72
72
|
const authz = useC4ConsoleAuthz({ orgId: props.orgId });
|
|
73
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);
|
|
74
79
|
const [cluster, setCluster] = useState(undefined);
|
|
75
80
|
const [clusterLoading, setClusterLoading] = useState(true);
|
|
76
81
|
const [clusterError, setClusterError] = useState('');
|
|
@@ -334,9 +339,17 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
334
339
|
return rows;
|
|
335
340
|
}, [client, cluster, oauthTokenUrl, props.clusterId, t]);
|
|
336
341
|
// -----------------------------
|
|
337
|
-
// Rename/Delete modals
|
|
342
|
+
// Rename/Rotate/Delete modals
|
|
338
343
|
// -----------------------------
|
|
339
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);
|
|
340
353
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
341
354
|
const [mutationBusy, setMutationBusy] = useState(false);
|
|
342
355
|
const [mutationError, setMutationError] = useState('');
|
|
@@ -354,6 +367,11 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
354
367
|
setMutationError('');
|
|
355
368
|
}
|
|
356
369
|
}, [deleteOpen]);
|
|
370
|
+
useEffect(() => {
|
|
371
|
+
if (rotateOpen) {
|
|
372
|
+
setMutationError('');
|
|
373
|
+
}
|
|
374
|
+
}, [rotateOpen]);
|
|
357
375
|
const clientNameValidationMessage = useMemo(() => {
|
|
358
376
|
if (!renameOpen) {
|
|
359
377
|
return undefined;
|
|
@@ -413,6 +431,40 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
413
431
|
setMutationBusy(false);
|
|
414
432
|
}
|
|
415
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]);
|
|
416
468
|
const onSubmitDelete = useCallback(async () => {
|
|
417
469
|
if (!client) {
|
|
418
470
|
return;
|
|
@@ -448,17 +500,21 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
448
500
|
// -----------------------------
|
|
449
501
|
// Render
|
|
450
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;
|
|
451
507
|
if (clusterLoading || clientsLoading) {
|
|
452
|
-
return (_jsx(Stack, { gap: 4, children: _jsx("div", { style: {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
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] }));
|
|
459
515
|
}
|
|
460
516
|
if (!client) {
|
|
461
|
-
return _jsx(_Fragment, {});
|
|
517
|
+
return _jsx(_Fragment, { children: rotatedSecretModal });
|
|
462
518
|
}
|
|
463
519
|
const menuItems = canMutateCluster
|
|
464
520
|
? [
|
|
@@ -467,6 +523,15 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
467
523
|
label: safeTranslate(t, 'clusterclients:update.heading', 'Rename'),
|
|
468
524
|
onClick: () => setRenameOpen(true),
|
|
469
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
|
+
: []),
|
|
470
535
|
{
|
|
471
536
|
key: 'Delete',
|
|
472
537
|
label: safeTranslate(t, 'clusterclients:delete.heading', 'Delete'),
|
|
@@ -505,7 +570,9 @@ export const C4ClusterClientDetailsApp = observer((props) => {
|
|
|
505
570
|
void onSubmitRename();
|
|
506
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) => {
|
|
507
572
|
setClientName(event.target.value);
|
|
508
|
-
}, 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: () => {
|
|
509
576
|
void onSubmitDelete();
|
|
510
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.') })] }) }))] }));
|
|
511
578
|
});
|
|
@@ -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('');
|
|
@@ -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: () => {
|
|
@@ -12,6 +12,7 @@ import { observer } from 'mobx-react-lite';
|
|
|
12
12
|
import { Fragment, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
13
13
|
import { normalizeClusterStatus } from '../../../components/c4-cluster-overview/applications.js';
|
|
14
14
|
import { C4ClusterOverview } from '../../../components/c4-cluster-overview/c4-cluster-overview.js';
|
|
15
|
+
import { C4ClusterTagSelector } from '../../../components/c4-cluster-tag-selector/c4-cluster-tag-selector.js';
|
|
15
16
|
import { C4Divider } from '../../../components/c4-divider/c4-divider.js';
|
|
16
17
|
import { C4InlineNotification } from '../../../components/c4-inline-notification/c4-inline-notification.js';
|
|
17
18
|
import { C4MultiStepUglyModal } from '../../../components/c4-multi-step-modal-ugly/c4-multi-step-modal-ugly.js';
|
|
@@ -19,7 +20,7 @@ import { C4OptimizeActivationModal } from '../../../components/c4-optimize-activ
|
|
|
19
20
|
import { addC4ConsoleNotification } from '../../../notifications/c4-console-notifications-handle.js';
|
|
20
21
|
import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
|
|
21
22
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
22
|
-
import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../../runtime/c4-console-runtime-context.js';
|
|
23
|
+
import { useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, } from '../../../runtime/c4-console-runtime-context.js';
|
|
23
24
|
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../../runtime/cluster-creation-blocked.js';
|
|
24
25
|
import { Checkbox, Link, Modal, Stack, Tag } from '../../../ui/index.js';
|
|
25
26
|
import { useRadioFamily } from '../../../ui/families.js';
|
|
@@ -50,6 +51,7 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
50
51
|
const { RadioButton, RadioButtonGroup } = useRadioFamily();
|
|
51
52
|
const c3Profile = useC3Profile();
|
|
52
53
|
const runtime = useC4ConsoleRuntime();
|
|
54
|
+
const designSystem = useC4DesignSystem();
|
|
53
55
|
const wakeInFlight = useRef(false);
|
|
54
56
|
const { cluster, clusterError, creationParameters, clustersOfOrg, clusterPlanTypeReservations, clusterLoadLatest, clusterLoadPerDay, clusterLoad24h, clusterLoadLoading, canSeeClusterLoad, canEditCluster, canWakeCluster, canSleepCluster, canManageUsers, canViewConnectorsLink, hasIdentityIntegration, orgId, clusterId, jobDashboardEnabled, upgradeDocsUrls, statisticsConfig, apiConfig, t, onReloadCluster, onReloadClusterLoad, onNavigate, ignoreGracePeriod, clusterLoadDocsUrl, restoreInProgress, overviewSection, sectionVariant, } = props;
|
|
55
57
|
const data = useC4ConsoleData();
|
|
@@ -877,6 +879,10 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
877
879
|
description: safeTranslate(t, 'clusterdetails:tags.options.prod.description', 'Indicates the live system with the latest software, deployable only by admins and organization owners through the interface.'),
|
|
878
880
|
},
|
|
879
881
|
], [t]);
|
|
882
|
+
const tagSelectorBoxes = useMemo(() => stageOptions.reduce((boxes, option) => {
|
|
883
|
+
boxes[option.value] = { text: option.description };
|
|
884
|
+
return boxes;
|
|
885
|
+
}, {}), [stageOptions]);
|
|
880
886
|
const openTagModal = useCallback(() => {
|
|
881
887
|
if (!cluster) {
|
|
882
888
|
return;
|
|
@@ -1588,7 +1594,9 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
1588
1594
|
if (tagBusy)
|
|
1589
1595
|
return;
|
|
1590
1596
|
setTagModalOpen(false);
|
|
1591
|
-
}, onRequestSubmit: submitTagChange, children: _jsxs(Stack, { gap: 5, children: [tagError ? (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, title: safeTranslate(t, 'clusterdetails:tags.modal.error', 'Error updating tag'), subtitle: tagError, hideCloseButton: true })) : null, _jsx("p", { children: safeTranslate(t, 'clusterdetails:tags.modal.description', 'Assign a tag to make it easier for team members to clearly distinguish between different stages of the software development lifecycle. Tags have no impact on performance and can be changed later.') }), _jsx(
|
|
1597
|
+
}, onRequestSubmit: submitTagChange, children: _jsxs(Stack, { gap: 5, children: [tagError ? (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, title: safeTranslate(t, 'clusterdetails:tags.modal.error', 'Error updating tag'), subtitle: tagError, hideCloseButton: true })) : null, _jsx("p", { children: safeTranslate(t, 'clusterdetails:tags.modal.description', 'Assign a tag to make it easier for team members to clearly distinguish between different stages of the software development lifecycle. Tags have no impact on performance and can be changed later.') }), designSystem === 'ds' ? (_jsx(C4ClusterTagSelector, { boxes: tagSelectorBoxes, isDevCluster: false, currentStage: selectedTag === '' ? undefined : selectedTag, onChange: setSelectedTag, save: {
|
|
1598
|
+
allowed: !tagBusy && canEditCluster && !restoreInProgress,
|
|
1599
|
+
} })) : (_jsx("div", { style: {
|
|
1592
1600
|
display: 'grid',
|
|
1593
1601
|
gridTemplateColumns: 'repeat(2, minmax(0, 1fr))',
|
|
1594
1602
|
gap: '1rem',
|
|
@@ -1613,7 +1621,7 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
|
|
|
1613
1621
|
color: 'var(--cds-icon-primary)',
|
|
1614
1622
|
display: 'flex',
|
|
1615
1623
|
}, children: _jsx(CheckmarkFilled, {}) })) : null] }), _jsx("p", { children: option.description })] }) }, option.value));
|
|
1616
|
-
}) })] }) }), _jsx(C4ClusterOverview, { applications: {
|
|
1624
|
+
}) }))] }) }), _jsx(C4ClusterOverview, { applications: {
|
|
1617
1625
|
title: safeTranslate(t, 'clusterdetails:overview.applications.title', 'Components'),
|
|
1618
1626
|
variant: sectionVariant,
|
|
1619
1627
|
applications: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ConsoleClusterService } from '@camunda/ccma-api';
|
|
3
|
-
import { BUSINESS_ID_UNIQUENESS_MIN_VERSION, BYOIDP_MIN_VERSION, checkVersion, ENFORCE_GROUPS_TASKLIST_V2_HIDDEN_MIN_VERSION, ENFORCE_GROUPS_TOGGLE_MIN_VERSION, IDENTITY_MANAGEMENT_MIN_VERSION, isAppIntegrationsVersionSupported, isSecretsFilterModeConfigurable, LINE_8_10_MIN_VERSION, MCP_MIN_VERSION, MULTI_TENANCY_TOGGLE_MIN_VERSION, OPTIMIZE_FILTERING_MIN_VERSION,
|
|
3
|
+
import { BUSINESS_ID_UNIQUENESS_MIN_VERSION, BYOIDP_MIN_VERSION, checkVersion, ENFORCE_GROUPS_TASKLIST_V2_HIDDEN_MIN_VERSION, ENFORCE_GROUPS_TOGGLE_MIN_VERSION, IDENTITY_MANAGEMENT_MIN_VERSION, isAppIntegrationsVersionSupported, isSecretsFilterModeConfigurable, LINE_8_10_MIN_VERSION, MCP_MIN_VERSION, MULTI_TENANCY_TOGGLE_MIN_VERSION, OPTIMIZE_FILTERING_MIN_VERSION, RESOURCE_BASED_AUTHORIZATIONS_MIN_VERSION, SESSION_CONFIG_MIN_VERSION, SWAGGER_MIN_VERSION, TASKLIST_UPGRADE_BANNER_MIN_VERSION, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
4
4
|
import { Fragment, useCallback, useMemo, useState, } from 'react';
|
|
5
5
|
import { C4ClusterSettings } from '../../../components/c4-cluster-settings/c4-cluster-settings.js';
|
|
6
6
|
import { ExternalIdentityProviderModal, } from '../../../components/c4-cluster-settings/elements/external-identity-provider-modal.js';
|
|
@@ -38,7 +38,6 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
38
38
|
const [isUpdatingSecretsFilterMode, setIsUpdatingSecretsFilterMode] = useState(false);
|
|
39
39
|
const [isUpdatingBusinessIdUniqueness, setIsUpdatingBusinessIdUniqueness] = useState(false);
|
|
40
40
|
const [isUpdatingAppIntegrations, setIsUpdatingAppIntegrations] = useState(false);
|
|
41
|
-
const [isUpdatingOptionalTelemetry, setIsUpdatingOptionalTelemetry] = useState(false);
|
|
42
41
|
const [isUpdatingTasklistV2, setIsUpdatingTasklistV2] = useState(false);
|
|
43
42
|
const [showTasklistV2ConfirmModal, setShowTasklistV2ConfirmModal] = useState(false);
|
|
44
43
|
const [tasklistV2UpgradeError, setTasklistV2UpgradeError] = useState(undefined);
|
|
@@ -384,33 +383,6 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
384
383
|
setIsUpdatingAppIntegrations(false);
|
|
385
384
|
}
|
|
386
385
|
}, [props, runtime.telemetry]);
|
|
387
|
-
const toggleOptionalTelemetry = useCallback(async () => {
|
|
388
|
-
if (!props.cluster)
|
|
389
|
-
return;
|
|
390
|
-
const nextState = !(props.cluster.optionalTelemetryEnabled ?? true);
|
|
391
|
-
setIsUpdatingOptionalTelemetry(true);
|
|
392
|
-
try {
|
|
393
|
-
await ConsoleClusterService.updateCluster({
|
|
394
|
-
config: props.apiConfig,
|
|
395
|
-
params: { orgId: props.orgId, clusterId: props.clusterId },
|
|
396
|
-
body: { optionalTelemetryEnabled: nextState },
|
|
397
|
-
});
|
|
398
|
-
await props.onReloadCluster();
|
|
399
|
-
}
|
|
400
|
-
catch (error) {
|
|
401
|
-
runtime.telemetry?.captureException?.(error, {
|
|
402
|
-
eventName: `optionalTelemetry:${nextState}:confirm`,
|
|
403
|
-
message: `Error while ${nextState ? 'enabling' : 'disabling'} optional telemetry`,
|
|
404
|
-
orgId: props.orgId,
|
|
405
|
-
clusterId: props.clusterId,
|
|
406
|
-
state: nextState,
|
|
407
|
-
});
|
|
408
|
-
setOperationError(error instanceof Error ? error.message : settingUpdateFailedFallback);
|
|
409
|
-
}
|
|
410
|
-
finally {
|
|
411
|
-
setIsUpdatingOptionalTelemetry(false);
|
|
412
|
-
}
|
|
413
|
-
}, [props, runtime.telemetry]);
|
|
414
386
|
const toggleTasklistV2 = useCallback(async () => {
|
|
415
387
|
if (!props.cluster)
|
|
416
388
|
return;
|
|
@@ -771,30 +743,6 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
771
743
|
props.cluster?.generation?.versions?.connectorBridge,
|
|
772
744
|
isAppIntegrationsFeatureEnabled,
|
|
773
745
|
]);
|
|
774
|
-
const isOptionalTelemetryFeatureEnabled = runtime.featureFlags?.isEnabled?.('console.optionalTelemetry') ?? false;
|
|
775
|
-
const shouldShowOptionalTelemetry = useMemo(() => {
|
|
776
|
-
if (!isOptionalTelemetryFeatureEnabled) {
|
|
777
|
-
return false;
|
|
778
|
-
}
|
|
779
|
-
// The broker's analytics-exporter exists from 8.10.0-alpha1 onward
|
|
780
|
-
// (camunda-operator's AnalyticsExporterSupported feature gate). The floor
|
|
781
|
-
// here is higher because the toggle stays untested on real clusters
|
|
782
|
-
// below alpha5.
|
|
783
|
-
return checkClusterVersion(OPTIONAL_TELEMETRY_MIN_VERSION);
|
|
784
|
-
}, [checkClusterVersion, isOptionalTelemetryFeatureEnabled]);
|
|
785
|
-
// Both directions feed getZeebeSpec's analyticsExporter and restart the
|
|
786
|
-
// cluster, so both go through the shared restart confirmation. Only the disable
|
|
787
|
-
// direction gets the data-collection wording, since that's the direction
|
|
788
|
-
// that changes what leaves the cluster.
|
|
789
|
-
const handleOptionalTelemetryClick = useCallback(() => {
|
|
790
|
-
const currentlyEnabled = props.cluster?.optionalTelemetryEnabled ?? true;
|
|
791
|
-
restartConfirm.request({
|
|
792
|
-
onConfirm: toggleOptionalTelemetry,
|
|
793
|
-
...(currentlyEnabled && {
|
|
794
|
-
body: (_jsx("p", { children: safeTranslate(props.t, 'clusterdetails:settings.optionalTelemetry.confirmBody', "Turning off optional telemetry restarts your cluster. Your cluster is briefly unavailable while it restarts. Camunda still collects contractual telemetry, which is required and can't be turned off.") })),
|
|
795
|
-
}),
|
|
796
|
-
});
|
|
797
|
-
}, [props.cluster, props.t, restartConfirm, toggleOptionalTelemetry]);
|
|
798
746
|
// Optimize data filters feed the generated spec, so a change restarts the
|
|
799
747
|
// cluster. The toggle/save actions are awaited by the child panel, so route
|
|
800
748
|
// them through the promise-based restart-confirm wrapper.
|
|
@@ -1166,23 +1114,7 @@ export const C4ClusterDetailsSettingsTab = (props) => {
|
|
|
1166
1114
|
},
|
|
1167
1115
|
},
|
|
1168
1116
|
}),
|
|
1169
|
-
}, ...(
|
|
1170
|
-
// Its own peer tile, not a row inside `settings` — CONTRACTUAL
|
|
1171
|
-
// telemetry has no toggle anywhere, per issue #9725.
|
|
1172
|
-
optionalTelemetrySettings: {
|
|
1173
|
-
title: safeTranslate(props.t, 'clusterdetails:settings.optionalTelemetry.tileTitle', 'Optional telemetry'),
|
|
1174
|
-
enabled: props.cluster.optionalTelemetryEnabled ?? true,
|
|
1175
|
-
description: safeTranslate(props.t, 'clusterdetails:settings.optionalTelemetry.description', "Camunda collects optional usage data from this cluster to improve our products. When disabled, Camunda still collects contractual telemetry, which is required and can't be turned off."),
|
|
1176
|
-
permissions: {
|
|
1177
|
-
mayChange: effectiveCanEdit,
|
|
1178
|
-
},
|
|
1179
|
-
action: {
|
|
1180
|
-
label: safeTranslate(props.t, 'clusterdetails:settings.optionalTelemetry.title', 'Enable optional telemetry'),
|
|
1181
|
-
onClick: handleOptionalTelemetryClick,
|
|
1182
|
-
disabled: isUpdatingOptionalTelemetry,
|
|
1183
|
-
},
|
|
1184
|
-
},
|
|
1185
|
-
}), ...(canUpgradeTasklist &&
|
|
1117
|
+
}, ...(canUpgradeTasklist &&
|
|
1186
1118
|
!props.cluster.externalMetadata?.tasklistV2Enabled && {
|
|
1187
1119
|
tasklistSettings: {
|
|
1188
1120
|
title: safeTranslate(props.t, 'clusterdetails:settings.tasklistMode.title', 'Upgrade to Tasklist v2'),
|
|
@@ -250,7 +250,7 @@ export function buildCreateClusterTranslations(t) {
|
|
|
250
250
|
duplicateTitle: translate('createcluster:duplicate.title', 'Duplicate a cluster'),
|
|
251
251
|
duplicateNoticeTitle: translate('createcluster:duplicate.notice.title', 'Copying settings from'),
|
|
252
252
|
duplicateNoticeCopied: translate('createcluster:duplicate.notice.copied', 'Your connector secrets, alerts, IP allowlist, and other cluster settings carry over to the new cluster.'),
|
|
253
|
-
duplicateNoticeNotCopied: translate('createcluster:duplicate.notice.notCopied', 'Process data is not copied — the new cluster starts empty. Each API client is recreated with a new client ID and secret
|
|
253
|
+
duplicateNoticeNotCopied: translate('createcluster:duplicate.notice.notCopied', 'Process data is not copied — the new cluster starts empty. Each API client is recreated with a new client ID and secret. Use Rotate secret on the new cluster to see the new secret of a client, then update your applications.'),
|
|
254
254
|
duplicateCta: translate('createcluster:duplicate.cta.create', 'Duplicate cluster'),
|
|
255
255
|
duplicateCtaSubmitting: translate('createcluster:duplicate.cta.states.submitting', 'Duplicating cluster...'),
|
|
256
256
|
duplicateCtaSuccess: translate('createcluster:duplicate.cta.states.success', 'Cluster will now be created'),
|
|
@@ -99,7 +99,7 @@ function toUsageChartPoints(entries, clusterNames, orgName) {
|
|
|
99
99
|
* - Quick links
|
|
100
100
|
*/
|
|
101
101
|
export const C4DashboardApp = observer((props) => {
|
|
102
|
-
const { orgId, t, onNavigate, urls, billing, hdpValueMetricsFor2025Enabled = false, isLicensingModel2025: isLicensingModel2025Prop, theme = 'white', } = props;
|
|
102
|
+
const { orgId, t, onNavigate, urls, billing, embedded = false, hdpValueMetricsFor2025Enabled = false, isLicensingModel2025: isLicensingModel2025Prop, theme = 'white', } = props;
|
|
103
103
|
const authz = useC4ConsoleAuthz({ orgId });
|
|
104
104
|
const data = useC4ConsoleData();
|
|
105
105
|
const runtime = useC4ConsoleRuntime();
|
|
@@ -503,7 +503,7 @@ export const C4DashboardApp = observer((props) => {
|
|
|
503
503
|
}, displayFirstCTA: false }));
|
|
504
504
|
}
|
|
505
505
|
// Render dashboard component
|
|
506
|
-
return (_jsx(C4ConsoleDashboard, { orgId: orgId, usersAmount: canViewUsers ? (shouldLoadMembers ? usersCount : 'N/A') : 'N/A', taskUsersAmount: effectiveBilling?.taskUsersAmount || 0, clustersAmount: clusters.length, clientsAmount: clientsCount, clusters: clustersOverview, clusterLoadAvailable: clusterLoadAvailable, processInstancesChart: {
|
|
506
|
+
return (_jsx(C4ConsoleDashboard, { orgId: orgId, embedded: embedded, usersAmount: canViewUsers ? (shouldLoadMembers ? usersCount : 'N/A') : 'N/A', taskUsersAmount: effectiveBilling?.taskUsersAmount || 0, clustersAmount: clusters.length, clientsAmount: clientsCount, clusters: clustersOverview, clusterLoadAvailable: clusterLoadAvailable, processInstancesChart: {
|
|
507
507
|
title: '',
|
|
508
508
|
theme,
|
|
509
509
|
axes: {
|
|
@@ -3,6 +3,12 @@ export interface C4DashboardAppProps {
|
|
|
3
3
|
* Organization ID
|
|
4
4
|
*/
|
|
5
5
|
orgId: string;
|
|
6
|
+
/**
|
|
7
|
+
* When true, the host owns the outer page chrome. In DS mode, this removes
|
|
8
|
+
* the widget page padding. Dashboard section headings stay visible.
|
|
9
|
+
* Defaults to false.
|
|
10
|
+
*/
|
|
11
|
+
embedded?: boolean;
|
|
6
12
|
/**
|
|
7
13
|
* Optional translate function for i18n
|
|
8
14
|
* If not provided, English fallbacks will be used
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'react';
|
|
2
2
|
import type { C4ManagementAppProps } from './c4-management-app.types.js';
|
|
3
|
-
export declare const C4ManagementApp: (({ orgId, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, tenantsValueMetricEnabled, hdpValueMetricsFor2025Enabled, permissionsReworkEnabled, urls, onNeedsReload, }: C4ManagementAppProps) => JSX.Element) & {
|
|
3
|
+
export declare const C4ManagementApp: (({ orgId, embedded, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, tenantsValueMetricEnabled, hdpValueMetricsFor2025Enabled, permissionsReworkEnabled, urls, onNeedsReload, }: C4ManagementAppProps) => JSX.Element) & {
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
@@ -16,7 +16,8 @@ import { C4ExtendTrialModal } from '../../components/c4-extend-trial-modal/c4-ex
|
|
|
16
16
|
import { C4LeaveOrganizationModal } from '../../components/c4-leave-organization-modal/c4-leave-organization-modal.js';
|
|
17
17
|
import { getC4ManagementUrls } from '../../externalUrls.const.js';
|
|
18
18
|
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
19
|
-
import { useC4ConsoleRuntime, useC4DesignSystem, } from '../../runtime/c4-console-runtime-context.js';
|
|
19
|
+
import { useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
|
|
20
|
+
import { ORG_CLUSTER_DEFAULTS_FLAG } from '../../runtime/org-cluster-defaults.js';
|
|
20
21
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
21
22
|
import { toIdentityApiBaseUrl } from '../../runtime/to-identity-api-base-url.js';
|
|
22
23
|
import { useHubApiNaming } from '../../runtime/use-hub-api-naming.js';
|
|
@@ -30,6 +31,7 @@ import { managementTab } from './management-tabs.js';
|
|
|
30
31
|
import { C4ManagementActivityTab } from './tabs/c4-management-activity-tab.js';
|
|
31
32
|
import { C4ManagementApiTab } from './tabs/c4-management-api-tab.js';
|
|
32
33
|
import { C4ManagementBillingTab } from './tabs/c4-management-billing-tab.js';
|
|
34
|
+
import { C4ManagementClusterDefaultsTab } from './tabs/c4-management-cluster-defaults-tab.js';
|
|
33
35
|
import { C4ManagementOverviewTab } from './tabs/c4-management-overview-tab.js';
|
|
34
36
|
import { C4ManagementPricingTab } from './tabs/c4-management-pricing-tab.js';
|
|
35
37
|
import { C4ManagementSettingsTab } from './tabs/c4-management-settings-tab.js';
|
|
@@ -544,7 +546,7 @@ function themeNameToClassName(theme) {
|
|
|
544
546
|
return 'g10';
|
|
545
547
|
}
|
|
546
548
|
}
|
|
547
|
-
export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, tenantsValueMetricEnabled = false, hdpValueMetricsFor2025Enabled = false, permissionsReworkEnabled = false, urls, onNeedsReload, }) => {
|
|
549
|
+
export const C4ManagementApp = observer(({ orgId, embedded = false, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, tenantsValueMetricEnabled = false, hdpValueMetricsFor2025Enabled = false, permissionsReworkEnabled = false, urls, onNeedsReload, }) => {
|
|
548
550
|
const runtime = useC4ConsoleRuntime();
|
|
549
551
|
const designSystem = useC4DesignSystem();
|
|
550
552
|
const hubNaming = useHubApiNaming();
|
|
@@ -946,6 +948,21 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
946
948
|
const [audits, setAudits] = useState([]);
|
|
947
949
|
const [auditsLoading, setAuditsLoading] = useState(false);
|
|
948
950
|
const [auditsDownloading, setAuditsDownloading] = useState(false);
|
|
951
|
+
// Cluster creation defaults of the organization (#9732). They come from
|
|
952
|
+
// the organization metadata, thus accounts serves them, and console reads
|
|
953
|
+
// the same record when it creates a cluster.
|
|
954
|
+
const [clusterDefaults, setClusterDefaults] = useState({});
|
|
955
|
+
const [clusterDefaultsLoading, setClusterDefaultsLoading] = useState(false);
|
|
956
|
+
// The organization that the record above belongs to. This widget stays
|
|
957
|
+
// mounted when `orgId` changes, thus without it a late answer of the
|
|
958
|
+
// organization before could land in the page of the one now — and a save
|
|
959
|
+
// would write the value of the first into the second.
|
|
960
|
+
const clusterDefaultsOrgRef = useRef(undefined);
|
|
961
|
+
const [clusterDefaultsError, setClusterDefaultsError] = useState(undefined);
|
|
962
|
+
// A failed save is its own state. It must not make the tab read-only:
|
|
963
|
+
// the member changes nothing about the reason, thus the only way on is
|
|
964
|
+
// to try again.
|
|
965
|
+
const [clusterDefaultsSaveError, setClusterDefaultsSaveError] = useState(undefined);
|
|
949
966
|
const [llmUsage, setLlmUsage] = useState(undefined);
|
|
950
967
|
const [llmUsageLoading, setLlmUsageLoading] = useState(false);
|
|
951
968
|
const [llmUsageError, setLlmUsageError] = useState(false);
|
|
@@ -2017,6 +2034,9 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
2017
2034
|
usageTenantPerCluster,
|
|
2018
2035
|
]);
|
|
2019
2036
|
const canReadActivity = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'activity', 'read']), [org]);
|
|
2037
|
+
const clusterDefaultsTabEnabled = useC4FeatureFlag(ORG_CLUSTER_DEFAULTS_FLAG);
|
|
2038
|
+
// The same permission that the accounts route asks for on the write.
|
|
2039
|
+
const canChangeOrgSettings = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'settings', 'update']), [org]);
|
|
2020
2040
|
const loadAudits = useCallback(async (opts) => {
|
|
2021
2041
|
if (!canReadActivity) {
|
|
2022
2042
|
setAudits([]);
|
|
@@ -2144,6 +2164,63 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
2144
2164
|
members,
|
|
2145
2165
|
org?.name,
|
|
2146
2166
|
]);
|
|
2167
|
+
const loadClusterDefaults = useCallback(async () => {
|
|
2168
|
+
clusterDefaultsOrgRef.current = orgId;
|
|
2169
|
+
setClusterDefaultsLoading(true);
|
|
2170
|
+
setClusterDefaultsError(undefined);
|
|
2171
|
+
try {
|
|
2172
|
+
const data = await OrgsService.getOrgClusterDefaults({
|
|
2173
|
+
config: apiConfig,
|
|
2174
|
+
params: { orgId },
|
|
2175
|
+
});
|
|
2176
|
+
if (clusterDefaultsOrgRef.current !== orgId) {
|
|
2177
|
+
return;
|
|
2178
|
+
}
|
|
2179
|
+
setClusterDefaults(data.defaults);
|
|
2180
|
+
}
|
|
2181
|
+
catch {
|
|
2182
|
+
if (clusterDefaultsOrgRef.current !== orgId) {
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
setClusterDefaultsError('The settings could not be loaded. Reload the page to try again.');
|
|
2186
|
+
}
|
|
2187
|
+
finally {
|
|
2188
|
+
if (clusterDefaultsOrgRef.current === orgId) {
|
|
2189
|
+
setClusterDefaultsLoading(false);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
}, [apiConfig, orgId]);
|
|
2193
|
+
// `C4Tabs` calls `initializeTab` once per mounted tab id, and this widget
|
|
2194
|
+
// stays mounted when `orgId` changes, thus the tab would keep the record
|
|
2195
|
+
// of the organization before. The load belongs to the organization, not
|
|
2196
|
+
// to the first render of the tab.
|
|
2197
|
+
useEffect(() => {
|
|
2198
|
+
setClusterDefaults({});
|
|
2199
|
+
setClusterDefaultsError(undefined);
|
|
2200
|
+
setClusterDefaultsSaveError(undefined);
|
|
2201
|
+
if (clusterDefaultsTabEnabled && canChangeOrgSettings) {
|
|
2202
|
+
void loadClusterDefaults();
|
|
2203
|
+
}
|
|
2204
|
+
}, [
|
|
2205
|
+
orgId,
|
|
2206
|
+
clusterDefaultsTabEnabled,
|
|
2207
|
+
canChangeOrgSettings,
|
|
2208
|
+
loadClusterDefaults,
|
|
2209
|
+
]);
|
|
2210
|
+
const saveClusterDefaults = useCallback(async (defaults) => {
|
|
2211
|
+
setClusterDefaultsSaveError(undefined);
|
|
2212
|
+
try {
|
|
2213
|
+
const saved = await OrgsService.updateOrgClusterDefaults({
|
|
2214
|
+
config: apiConfig,
|
|
2215
|
+
params: { orgId },
|
|
2216
|
+
body: { defaults },
|
|
2217
|
+
});
|
|
2218
|
+
setClusterDefaults(saved.defaults);
|
|
2219
|
+
}
|
|
2220
|
+
catch (error) {
|
|
2221
|
+
setClusterDefaultsSaveError(clientErrorMessage(error));
|
|
2222
|
+
}
|
|
2223
|
+
}, [apiConfig, orgId]);
|
|
2147
2224
|
const loadLlmUsage = useCallback(async () => {
|
|
2148
2225
|
setLlmUsageLoading(true);
|
|
2149
2226
|
setLlmUsageError(false);
|
|
@@ -3153,6 +3230,16 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
3153
3230
|
void loadApiClients();
|
|
3154
3231
|
},
|
|
3155
3232
|
},
|
|
3233
|
+
{
|
|
3234
|
+
id: 'clusterDefaults',
|
|
3235
|
+
label: getTabLabel(legacyTabs, 'clusterDefaults', tabTitle('clusterDefaults')),
|
|
3236
|
+
// Flagged, and shown to the members that may change the settings of
|
|
3237
|
+
// the organization. Reading alone has no value here: the tab holds
|
|
3238
|
+
// the values that the next cluster starts with, and a member that
|
|
3239
|
+
// cannot change them reads the same values on the cluster itself.
|
|
3240
|
+
visible: clusterDefaultsTabEnabled && canChangeOrgSettings,
|
|
3241
|
+
component: (_jsx(C4ManagementClusterDefaultsTab, { defaults: clusterDefaults, loading: clusterDefaultsLoading, error: clusterDefaultsError, saveError: clusterDefaultsSaveError, permissions: { mayChange: canChangeOrgSettings }, onSave: saveClusterDefaults })),
|
|
3242
|
+
},
|
|
3156
3243
|
{
|
|
3157
3244
|
id: 'settings',
|
|
3158
3245
|
label: getTabLabel(legacyTabs, 'settings', tabTitle('settings')),
|
|
@@ -3245,6 +3332,14 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
3245
3332
|
}, [
|
|
3246
3333
|
activityProps,
|
|
3247
3334
|
canReadActivity,
|
|
3335
|
+
canChangeOrgSettings,
|
|
3336
|
+
clusterDefaults,
|
|
3337
|
+
clusterDefaultsError,
|
|
3338
|
+
clusterDefaultsSaveError,
|
|
3339
|
+
clusterDefaultsLoading,
|
|
3340
|
+
clusterDefaultsTabEnabled,
|
|
3341
|
+
loadClusterDefaults,
|
|
3342
|
+
saveClusterDefaults,
|
|
3248
3343
|
apiClientPermissions.canRead,
|
|
3249
3344
|
apiTabProps,
|
|
3250
3345
|
aiUsageProps,
|
|
@@ -3396,7 +3491,7 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
|
|
|
3396
3491
|
finally {
|
|
3397
3492
|
setSettingsLoading(false);
|
|
3398
3493
|
}
|
|
3399
|
-
} }), isExtendModalOpen && (_jsx(C4ExtendTrialModal, { isOpen: isExtendModalOpen, onClose: () => setIsExtendModalOpen(false), onSubmit: submitExtendTrial, isSubmitting: isExtendSubmitting, error: extendError })), _jsx(C4ManagementPage, { loading: loading, notFound: notFound, tabs: {
|
|
3494
|
+
} }), isExtendModalOpen && (_jsx(C4ExtendTrialModal, { isOpen: isExtendModalOpen, onClose: () => setIsExtendModalOpen(false), onSubmit: submitExtendTrial, isSubmitting: isExtendSubmitting, error: extendError })), _jsx(C4ManagementPage, { loading: loading, notFound: notFound, embedded: embedded, tabs: {
|
|
3400
3495
|
list: mergedTabs,
|
|
3401
3496
|
desiredTabId: activeTabId,
|
|
3402
3497
|
onChange: (tabId) => {
|
|
@@ -43,6 +43,12 @@ export type C4ManagementNavigateEvent = {
|
|
|
43
43
|
};
|
|
44
44
|
export interface C4ManagementAppProps {
|
|
45
45
|
orgId: string;
|
|
46
|
+
/**
|
|
47
|
+
* When true, the host owns the outer page chrome. This removes the widget
|
|
48
|
+
* title in both design systems and its page padding in DS mode. Defaults to
|
|
49
|
+
* false.
|
|
50
|
+
*/
|
|
51
|
+
embedded?: boolean;
|
|
46
52
|
desiredTabId?: string;
|
|
47
53
|
onTabChange?: (tabId: string) => void;
|
|
48
54
|
onNavigate?: (event: C4ManagementNavigateEvent) => void;
|