@camunda/ccma-saas-frontend 0.11.0 → 0.12.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-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/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-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-rename-organization-modal/c4-rename-organization-modal.js +1 -11
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +46 -0
- package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +117 -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 +2 -1
- package/lib/esm/i18n/en/pages/clusterdetails.json +11 -1
- package/lib/esm/i18n/en/pages/createcluster.json +43 -0
- package/lib/esm/i18n/en/pages/orgmanagement.json +3 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/runtime/cluster-duplication.d.ts +10 -0
- package/lib/esm/runtime/cluster-duplication.js +15 -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 +2 -12
- 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 +1 -1
- 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 +1 -19
- 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 +1 -16
- 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 +1 -18
- 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.js +1 -20
- package/lib/esm/widgets/management/c4-management-page.js +1 -9
- 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-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
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ConsoleConnectorSecretsService } from '@camunda/ccma-api';
|
|
3
3
|
import { SECRETS_MAX_LENGTH, SseEntity } from '@camunda/ccma-shared-types';
|
|
4
|
-
import {
|
|
4
|
+
import { InlineLoading } from '@carbon/react';
|
|
5
5
|
import { observer } from 'mobx-react-lite';
|
|
6
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { C4ClusterDetailsConnectorSecrets } from '../../../components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js';
|
|
8
|
+
import { C4FileUploader } from '../../../components/c4-file-uploader/c4-file-uploader.js';
|
|
8
9
|
import { C4InlineNotification } from '../../../components/c4-inline-notification/c4-inline-notification.js';
|
|
9
10
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
10
|
-
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
11
|
+
import { useC4ConsoleRuntime, useC4DesignSystem, } from '../../../runtime/c4-console-runtime-context.js';
|
|
11
12
|
import { CodeSnippet, Form, Link, Modal, PasswordInput, Stack, TextArea, TextInput, } from '../../../ui/index.js';
|
|
12
13
|
import { useSelectFamily } from '../../../ui/families.js';
|
|
14
|
+
import { clientErrorMessage } from '../../../utils/http-error-message.js';
|
|
13
15
|
import { safeTranslate, scopedTranslate } from '../../../utils/safe-translate.js';
|
|
14
16
|
function renderInlineStrong(value) {
|
|
15
17
|
const match = value.match(/^(.*)<strong>(.*)<\/strong>(.*)$/);
|
|
@@ -27,10 +29,26 @@ function renderInlineLink0(value, linkRenderer) {
|
|
|
27
29
|
}
|
|
28
30
|
const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
29
31
|
const { Select, SelectItem } = useSelectFamily();
|
|
30
|
-
const { orgId, clusterId, apiConfig, canMutateCluster, connectorSecretsPermissions, docsUrl, t, onNavigate, useClusterSecretsLabel, permissionsLoading = false, scope = 'cluster', onPanelState, } = props;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const { orgId, clusterId, apiConfig, canMutateCluster, connectorSecretsPermissions, docsUrl, clusterSecretsDocsUrl, t, onNavigate, useClusterSecretsLabel, permissionsLoading = false, scope = 'cluster', onPanelState, } = props;
|
|
33
|
+
const designSystem = useC4DesignSystem();
|
|
34
|
+
const useDsClusterSecretsContent = designSystem === 'ds' && useClusterSecretsLabel;
|
|
35
|
+
const pickValue = (condition, defaultValue, alternateValue) => (condition ? alternateValue : defaultValue);
|
|
36
|
+
const resolvedDocsUrl = pickValue(useDsClusterSecretsContent, docsUrl, clusterSecretsDocsUrl);
|
|
37
|
+
const clusterEmptyState = pickValue(designSystem === 'ds', {
|
|
38
|
+
titleKey: 'clusterdetails:clusterSecrets.noSecrets.title',
|
|
39
|
+
titleFallback: 'No secrets',
|
|
40
|
+
descriptionKey: 'clusterdetails:clusterSecrets.noSecrets.description',
|
|
41
|
+
descriptionFallback: 'Create a cluster secret to reference encrypted credentials in your cluster.',
|
|
42
|
+
}, {
|
|
43
|
+
titleKey: 'clusterdetails:clusterSecrets.noSecretsDs.title',
|
|
44
|
+
titleFallback: 'Store sensitive values as cluster secrets',
|
|
45
|
+
descriptionKey: 'clusterdetails:clusterSecrets.noSecretsDs.description',
|
|
46
|
+
descriptionFallback: 'Cluster secrets store API keys, passwords, and other sensitive values. Reference them from credentials and supported fields.',
|
|
47
|
+
});
|
|
48
|
+
const pickSecretsText = (connectorKey, connectorFallback, clusterKey, clusterFallback) => {
|
|
49
|
+
const [key, fallback] = pickValue(useClusterSecretsLabel, [connectorKey, connectorFallback], [clusterKey, clusterFallback]);
|
|
50
|
+
return safeTranslate(t, key, fallback);
|
|
51
|
+
};
|
|
34
52
|
const data = useC4ConsoleData();
|
|
35
53
|
const runtime = useC4ConsoleRuntime();
|
|
36
54
|
// Console's own cluster-details page never mounts this tab without read
|
|
@@ -157,23 +175,21 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
157
175
|
useEffect(() => {
|
|
158
176
|
onPanelState?.({ isEmpty, title });
|
|
159
177
|
}, [isEmpty, title, onPanelState]);
|
|
160
|
-
// Neither empty-state description
|
|
161
|
-
//
|
|
162
|
-
// secrets vault without ever saying "cluster". Scope-neutral copy takes no
|
|
163
|
-
// scoped key: only strings that actually describe the surface get one.
|
|
178
|
+
// Neither empty-state description varies by surface scope, so only strings
|
|
179
|
+
// that actually describe the surface get a scoped key.
|
|
164
180
|
const emptyDescription = renderInlineStrong(useClusterSecretsLabel
|
|
165
|
-
? safeTranslate(t,
|
|
181
|
+
? safeTranslate(t, clusterEmptyState.descriptionKey, clusterEmptyState.descriptionFallback)
|
|
166
182
|
: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.description', 'Create a connector secret to use in your connectors.'));
|
|
167
183
|
// The cluster-secrets info text is the one string here that names the surface
|
|
168
184
|
// ("…credentials in your cluster"), so it is the one that takes a scoped key.
|
|
169
185
|
// The connector-secrets variant is scope-neutral and stays unscoped.
|
|
170
186
|
const infoText = renderInlineLink0(useClusterSecretsLabel
|
|
171
187
|
? scopedTranslate(t, scope, 'clusterdetails:clusterSecrets.infoText', 'Learn more about cluster secrets in our <0>documentation</0>.', 'Learn more about cluster secrets in our <0>documentation</0>.')
|
|
172
|
-
: safeTranslate(t, 'clusterdetails:connectorSecrets.infoText', 'Learn more about connector secrets in our <0>documentation</0>.'), (label) => (_jsx(Link, { size: 'sm', href:
|
|
188
|
+
: safeTranslate(t, 'clusterdetails:connectorSecrets.infoText', 'Learn more about connector secrets in our <0>documentation</0>.'), (label) => (_jsx(Link, { size: 'sm', href: resolvedDocsUrl ?? '', onClick: (e) => {
|
|
173
189
|
e.preventDefault();
|
|
174
190
|
onNavigate?.({
|
|
175
191
|
kind: 'openUrl',
|
|
176
|
-
url:
|
|
192
|
+
url: resolvedDocsUrl ?? '',
|
|
177
193
|
});
|
|
178
194
|
}, children: label })));
|
|
179
195
|
return (_jsxs(_Fragment, { children: [_jsx(C4ClusterDetailsConnectorSecrets, { secrets: secrets, isLoading: isListLoading, hasError: connectorSecretsError, hasImportFromClusterFeature: true, hasExportFeature: true, text: {
|
|
@@ -191,17 +207,17 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
191
207
|
errorTitle: safeTranslate(t, 'clusterdetails:connectorSecrets.fetchError.title', 'Could not load secrets'),
|
|
192
208
|
errorDescription: safeTranslate(t, 'clusterdetails:connectorSecrets.fetchError.description', 'Please try again.'),
|
|
193
209
|
errorButton: safeTranslate(t, 'clusterdetails:connectorSecrets.fetchError.button', 'Retry'),
|
|
194
|
-
emptyTitle: pickSecretsText('clusterdetails:connectorSecrets.noSecrets.title', 'No secrets',
|
|
210
|
+
emptyTitle: pickSecretsText('clusterdetails:connectorSecrets.noSecrets.title', 'No secrets', clusterEmptyState.titleKey, clusterEmptyState.titleFallback),
|
|
195
211
|
emptyDescription,
|
|
196
212
|
emptyCreateButton: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.button', 'Create secret'),
|
|
197
|
-
emptyLearnMoreLabel: safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.link', 'Learn more'),
|
|
213
|
+
emptyLearnMoreLabel: pickValue(useDsClusterSecretsContent, safeTranslate(t, 'clusterdetails:connectorSecrets.noSecrets.link', 'Learn more'), safeTranslate(t, 'clusterdetails:clusterSecrets.noSecretsDs.link', 'Learn more about cluster secrets')),
|
|
198
214
|
emptyIconAltText: pickSecretsText('clusterdetails:connectorSecrets.emptyIconAltText', 'Connector secrets icon', 'clusterdetails:clusterSecrets.emptyIconAltText', 'Cluster secrets icon'),
|
|
199
215
|
infoText,
|
|
200
216
|
// Label for the badge shown on CAMUNDA_PROVIDED_ secrets
|
|
201
217
|
protectedBadge: safeTranslate(t, 'clusterdetails:connectorSecrets.protectedBadge', 'Hidden'),
|
|
202
218
|
forbiddenTitle: pickSecretsText('clusterdetails:connectorSecrets.forbidden.title', "You don't have access to connector secrets", 'clusterdetails:clusterSecrets.forbidden.title', "You don't have access to cluster secrets"),
|
|
203
219
|
forbiddenDescription: pickSecretsText('clusterdetails:connectorSecrets.forbidden.description', "You don't have permission to view connector secrets for this cluster. Contact an organization owner or admin for access.", 'clusterdetails:clusterSecrets.forbidden.description', "You don't have permission to view cluster secrets for this cluster. Contact an organization owner or admin for access."),
|
|
204
|
-
}, urls: { docs:
|
|
220
|
+
}, urls: { docs: resolvedDocsUrl ?? '' }, permissions: {
|
|
205
221
|
canCreate: connectorSecretsPermissions?.canCreate ?? canMutateCluster,
|
|
206
222
|
canRead: connectorSecretsPermissions?.canRead ?? canMutateCluster,
|
|
207
223
|
canUpdate: connectorSecretsPermissions?.canUpdate ?? canMutateCluster,
|
|
@@ -274,7 +290,7 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
274
290
|
}, onRefresh: () => reloadConnectorSecrets(), onOpenDocs: () => {
|
|
275
291
|
onNavigate?.({
|
|
276
292
|
kind: 'openUrl',
|
|
277
|
-
url:
|
|
293
|
+
url: resolvedDocsUrl ?? '',
|
|
278
294
|
});
|
|
279
295
|
} }), _jsx(Modal, { open: secretCreateOpen, modalHeading: safeTranslate(t, 'connectorsecrets:create.heading', 'Create connector secret'), primaryButtonText: safeTranslate(t, 'connectorsecrets:create.buttons.primary', 'Create'), secondaryButtonText: safeTranslate(t, 'connectorsecrets:create.buttons.secondary', 'Cancel'), primaryButtonDisabled: secretMutationBusy, onRequestClose: () => {
|
|
280
296
|
trackEvent('listConnectors:create:cancel', 'Close Create Connector Secret Modal');
|
|
@@ -317,12 +333,19 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
317
333
|
setSecretMutationBusy(false);
|
|
318
334
|
}
|
|
319
335
|
})();
|
|
320
|
-
}, children: _jsxs(Stack, { gap: 6, children: [secretMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: secretMutationError, hideCloseButton: true, lowContrast: true })), _jsxs(Form, { children: [_jsx(TextInput, { id: 'secret-create-key', labelText: safeTranslate(t, 'connectorsecrets:create.fields.key', 'Key'), helperText: safeTranslate(t, 'connectorsecrets:create.fields.keyHelperText', 'Unique identifier for the secret'), maxLength: 50, value: secretKey, invalid: secretKeyInvalid, invalidText: 'Key is required',
|
|
336
|
+
}, children: _jsxs(Stack, { gap: 6, children: [secretMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: secretMutationError, hideCloseButton: true, lowContrast: true })), _jsxs(Form, { children: [_jsx(TextInput, { id: 'secret-create-key', labelText: safeTranslate(t, 'connectorsecrets:create.fields.key', 'Key'), helperText: safeTranslate(t, 'connectorsecrets:create.fields.keyHelperText', 'Unique identifier for the secret'), maxLength: 50, value: secretKey, invalid: secretKeyInvalid, invalidText: 'Key is required',
|
|
337
|
+
// The key of a connector secret is not a personal detail. The
|
|
338
|
+
// browser offered the keys of other forms, and one of them was a
|
|
339
|
+
// password field.
|
|
340
|
+
autoComplete: 'off', onChange: (event) => {
|
|
321
341
|
setSecretKey(event.target.value);
|
|
322
342
|
if (secretKeyInvalid && event.target.value.length > 0) {
|
|
323
343
|
setSecretKeyInvalid(false);
|
|
324
344
|
}
|
|
325
|
-
} }), _jsx(PasswordInput, { id: 'secret-create-value', labelText: safeTranslate(t, 'connectorsecrets:create.fields.value', 'Value'), maxLength: SECRETS_MAX_LENGTH, value: secretValue, invalid: secretValueInvalid, invalidText: 'Value is required',
|
|
345
|
+
} }), _jsx(PasswordInput, { id: 'secret-create-value', labelText: safeTranslate(t, 'connectorsecrets:create.fields.value', 'Value'), maxLength: SECRETS_MAX_LENGTH, value: secretValue, invalid: secretValueInvalid, invalidText: 'Value is required',
|
|
346
|
+
// Keeps the password manager of the browser away from a value
|
|
347
|
+
// that belongs to the cluster and not to the reader.
|
|
348
|
+
autoComplete: 'new-password', onChange: (event) => {
|
|
326
349
|
setSecretValue(event.target.value);
|
|
327
350
|
if (secretValueInvalid && event.target.value.length > 0) {
|
|
328
351
|
setSecretValueInvalid(false);
|
|
@@ -364,7 +387,7 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
364
387
|
setSecretMutationBusy(false);
|
|
365
388
|
}
|
|
366
389
|
})();
|
|
367
|
-
}, children: _jsxs(Stack, { gap: 6, children: [secretMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: secretMutationError, hideCloseButton: true, lowContrast: true })), _jsx(Form, { children: _jsx(PasswordInput, { id: 'secret-update-value', labelText: safeTranslate(t, 'connectorsecrets:update.fields.value', 'Value'), maxLength: SECRETS_MAX_LENGTH, value: secretValue, onChange: (event) => setSecretValue(event.target.value) }) })] }) }), _jsx(Modal, { open: secretDeleteOpen, danger: true, modalHeading: `${safeTranslate(t, 'connectorsecrets:delete.heading', 'Delete connector secret')}: ${secretKey}`, primaryButtonText: safeTranslate(t, 'connectorsecrets:delete.buttons.primary', 'Delete'), secondaryButtonText: safeTranslate(t, 'connectorsecrets:delete.buttons.secondary', 'Cancel'), primaryButtonDisabled: secretMutationBusy, onRequestClose: () => {
|
|
390
|
+
}, children: _jsxs(Stack, { gap: 6, children: [secretMutationError && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: secretMutationError, hideCloseButton: true, lowContrast: true })), _jsx(Form, { children: _jsx(PasswordInput, { id: 'secret-update-value', labelText: safeTranslate(t, 'connectorsecrets:update.fields.value', 'Value'), maxLength: SECRETS_MAX_LENGTH, value: secretValue, autoComplete: 'new-password', onChange: (event) => setSecretValue(event.target.value) }) })] }) }), _jsx(Modal, { open: secretDeleteOpen, danger: true, modalHeading: `${safeTranslate(t, 'connectorsecrets:delete.heading', 'Delete connector secret')}: ${secretKey}`, primaryButtonText: safeTranslate(t, 'connectorsecrets:delete.buttons.primary', 'Delete'), secondaryButtonText: safeTranslate(t, 'connectorsecrets:delete.buttons.secondary', 'Cancel'), primaryButtonDisabled: secretMutationBusy, onRequestClose: () => {
|
|
368
391
|
trackEvent('listConnectors:delete:cancel', 'Close Delete Connector Secret Modal', {
|
|
369
392
|
key: secretKey,
|
|
370
393
|
});
|
|
@@ -449,8 +472,19 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
449
472
|
}
|
|
450
473
|
// Import all secrets
|
|
451
474
|
let successCount = 0;
|
|
452
|
-
|
|
475
|
+
const failures = [];
|
|
453
476
|
for (const secret of secrets) {
|
|
477
|
+
// The backend answers a duplicate with a plain 4xx, and the
|
|
478
|
+
// reader then saw a count of failures with no reason. A name
|
|
479
|
+
// that is already on the cluster is the usual cause, thus this
|
|
480
|
+
// reason comes from the list that the page already holds.
|
|
481
|
+
if (Object.hasOwn(connectorSecretsMap, secret.key)) {
|
|
482
|
+
failures.push({
|
|
483
|
+
key: secret.key,
|
|
484
|
+
reason: safeTranslate(t, 'connectorsecrets:bulkImport.errors.duplicate', 'a secret with this key already exists'),
|
|
485
|
+
});
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
454
488
|
try {
|
|
455
489
|
await ConsoleConnectorSecretsService.create({
|
|
456
490
|
config: apiConfig,
|
|
@@ -473,14 +507,21 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
473
507
|
clusterId,
|
|
474
508
|
key: secret.key,
|
|
475
509
|
});
|
|
476
|
-
|
|
510
|
+
failures.push({
|
|
511
|
+
key: secret.key,
|
|
512
|
+
reason: clientErrorMessage(error) ??
|
|
513
|
+
safeTranslate(t, 'connectorsecrets:bulkImport.errors.unknown', 'the server rejected it'),
|
|
514
|
+
});
|
|
477
515
|
}
|
|
478
516
|
}
|
|
479
|
-
if (
|
|
517
|
+
if (failures.length === 0) {
|
|
480
518
|
setBulkImportOpen(false);
|
|
481
519
|
}
|
|
482
520
|
else {
|
|
483
|
-
|
|
521
|
+
const reasons = failures
|
|
522
|
+
.map((failure) => `${failure.key} — ${failure.reason}`)
|
|
523
|
+
.join('; ');
|
|
524
|
+
setBulkImportError(`Imported ${successCount} of ${secrets.length} secrets. Not imported: ${reasons}.`);
|
|
484
525
|
}
|
|
485
526
|
await reloadConnectorSecrets();
|
|
486
527
|
}
|
|
@@ -497,18 +538,26 @@ const C4ClusterDetailsConnectorSecretsTabImpl = (props) => {
|
|
|
497
538
|
setBulkImportBusy(false);
|
|
498
539
|
}
|
|
499
540
|
})();
|
|
500
|
-
}, size: 'md', children: _jsxs(Stack, { gap: 6, children: [bulkImportError && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: bulkImportError, hideCloseButton: true, lowContrast: true })), _jsx(
|
|
501
|
-
|
|
502
|
-
|
|
541
|
+
}, size: 'md', children: _jsxs(Stack, { gap: 6, children: [bulkImportError && (_jsx(C4InlineNotification, { kind: 'error', title: 'Error', subtitle: bulkImportError, hideCloseButton: true, lowContrast: true })), _jsx(C4FileUploader, { labelTitle: safeTranslate(t, 'connectorsecrets:bulkImport.fields.fileUploadLabel', 'Upload file'), labelDescription: safeTranslate(t, 'connectorsecrets:bulkImport.fields.fileUploadDescription', 'Select a .env or .txt file'), buttonLabel: safeTranslate(t, 'connectorsecrets:bulkImport.fields.fileUploadButton', 'Select file'), accept: ['.env', '.txt'], onFilesChange: (files) => {
|
|
542
|
+
// An empty list means that the reader removed the file. The
|
|
543
|
+
// content of that file is still in the box below, thus the
|
|
544
|
+
// dialog would import a file that the reader took away.
|
|
545
|
+
if (files.length === 0) {
|
|
546
|
+
setBulkImportContent('');
|
|
547
|
+
setBulkImportError('');
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
void (async () => {
|
|
503
551
|
try {
|
|
504
552
|
const text = await files[0].text();
|
|
505
553
|
setBulkImportContent(text);
|
|
506
554
|
setBulkImportContentInvalid(false);
|
|
555
|
+
setBulkImportError('');
|
|
507
556
|
}
|
|
508
557
|
catch {
|
|
509
558
|
setBulkImportError('Failed to read file');
|
|
510
559
|
}
|
|
511
|
-
}
|
|
560
|
+
})();
|
|
512
561
|
} }), _jsx(Form, { children: _jsx(TextArea, { id: 'bulk-import-content', labelText: safeTranslate(t, 'connectorsecrets:bulkImport.fields.envContent', 'Content'), helperText: safeTranslate(t, 'connectorsecrets:bulkImport.fields.envContentHelperText', 'KEY=VALUE format, one per line'), placeholder: 'MY_SECRET=secret_value\\nANOTHER_SECRET=another_value', value: bulkImportContent, invalid: bulkImportContentInvalid, invalidText: 'Content is required', rows: 12, onChange: (event) => {
|
|
513
562
|
setBulkImportContent(event.target.value);
|
|
514
563
|
if (bulkImportContentInvalid && event.target.value.trim()) {
|
|
@@ -11,6 +11,7 @@ import { useC4ConsoleNotifications } from '../../../runtime/c4-console-notificat
|
|
|
11
11
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
12
12
|
import { Checkbox, Modal, Stack, TextInput } from '../../../ui/index.js';
|
|
13
13
|
import { useSelectFamily } from '../../../ui/families.js';
|
|
14
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
14
15
|
const WEEKDAYS = [
|
|
15
16
|
'Monday',
|
|
16
17
|
'Tuesday',
|
|
@@ -169,12 +170,6 @@ function toDateOrDash(value) {
|
|
|
169
170
|
function isManualBackup(backup) {
|
|
170
171
|
return backup.name.includes('on-demand');
|
|
171
172
|
}
|
|
172
|
-
function safeTranslate(t, key, fallback) {
|
|
173
|
-
if (!t)
|
|
174
|
-
return fallback;
|
|
175
|
-
const result = t(key);
|
|
176
|
-
return result === key ? fallback : result;
|
|
177
|
-
}
|
|
178
173
|
const C4ClusterDetailsHotBackupsTabImpl = (props) => {
|
|
179
174
|
const { Select, SelectItem } = useSelectFamily();
|
|
180
175
|
const { cluster, orgId, clusterId, apiConfig, canMutateCluster, isHotBackupEnabled, manualBackupRetainedCount, scheduledBackupRetainedCount, docsUrls, t, onNavigate, onReloadCluster, } = props;
|
|
@@ -7,24 +7,7 @@ import { C4CreateIpWhitelistModal } from '../../../components/c4-create-ip-white
|
|
|
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 { Form, Modal, Stack, TextInput } from '../../../ui/index.js';
|
|
10
|
-
|
|
11
|
-
function safeTranslate(t, key, fallback) {
|
|
12
|
-
if (!t)
|
|
13
|
-
return fallback;
|
|
14
|
-
const result = t(key);
|
|
15
|
-
if (!result || result === key) {
|
|
16
|
-
return fallback;
|
|
17
|
-
}
|
|
18
|
-
// i18next can return the key *without* the namespace when the namespace is missing.
|
|
19
|
-
// Example: `ipwhitelist:data.title` -> `data.title`
|
|
20
|
-
if (key.includes(':')) {
|
|
21
|
-
const withoutNamespace = key.split(':').slice(1).join(':');
|
|
22
|
-
if (result === withoutNamespace) {
|
|
23
|
-
return fallback;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
10
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
28
11
|
function renderInlineStrong(value) {
|
|
29
12
|
const parts = value.split(/<strong>|<\/strong>/);
|
|
30
13
|
if (parts.length === 1)
|
|
@@ -23,28 +23,10 @@ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../../runtime/c4-cons
|
|
|
23
23
|
import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../../runtime/cluster-creation-blocked.js';
|
|
24
24
|
import { Checkbox, Link, Modal, Stack, Tag } from '../../../ui/index.js';
|
|
25
25
|
import { useRadioFamily } from '../../../ui/families.js';
|
|
26
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
26
27
|
import { clusterHealthOverride } from '../../cluster-health-override.js';
|
|
27
28
|
import { isClusterReconciliationPaused } from '../../is-cluster-reconciliation-paused.js';
|
|
28
29
|
import { buildClusterLoadTexts } from './cluster-load-texts.js';
|
|
29
|
-
// Local copy of `utils/safe-translate.ts`, because these call sites also pass
|
|
30
|
-
// interpolation options, which the shared helper does not take. Keep the miss
|
|
31
|
-
// detection of the two in step.
|
|
32
|
-
function safeTranslate(t, key, fallback, options) {
|
|
33
|
-
if (!t)
|
|
34
|
-
return fallback;
|
|
35
|
-
const result = t(key, options);
|
|
36
|
-
if (!result || result === key)
|
|
37
|
-
return fallback;
|
|
38
|
-
// i18next answers a miss with the key without its namespace:
|
|
39
|
-
// `clusterdetails:overview.title` -> `overview.title`. That is a miss too,
|
|
40
|
-
// and without this the raw key reaches the customer.
|
|
41
|
-
if (key.includes(':')) {
|
|
42
|
-
const withoutNamespace = key.split(':').slice(1).join(':');
|
|
43
|
-
if (result === withoutNamespace)
|
|
44
|
-
return fallback;
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
30
|
function renderStrongTextTranslation(t, key, fallback, options) {
|
|
49
31
|
const text = safeTranslate(t, key, fallback, options);
|
|
50
32
|
let offset = 0;
|
|
@@ -11,12 +11,7 @@ import { C4StructuredListBody, C4StructuredListCell, C4StructuredListRow, C4Stru
|
|
|
11
11
|
import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
|
|
12
12
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
13
13
|
import { Button, ComposedModal, FilterableMultiSelect, Modal, ModalBody, ModalFooter, ModalHeader, Stack, TextInput, Tile, } from '../../../ui/index.js';
|
|
14
|
-
|
|
15
|
-
if (!t)
|
|
16
|
-
return fallback;
|
|
17
|
-
const result = t(key);
|
|
18
|
-
return result === key ? fallback : result;
|
|
19
|
-
}
|
|
14
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
20
15
|
function adaptSecureConnectivityStatus(options) {
|
|
21
16
|
const { dto, orgId, clusterId } = options;
|
|
22
17
|
return {
|
|
@@ -9,24 +9,9 @@ import { buildClusterSsoCallbackUrl } from '../../../runtime/build-cluster-sso-c
|
|
|
9
9
|
import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
|
|
10
10
|
import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
|
|
11
11
|
import { Link, Modal } from '../../../ui/index.js';
|
|
12
|
+
import { safeTranslate } from '../../../utils/safe-translate.js';
|
|
12
13
|
import { isClusterReconciliationPaused } from '../../is-cluster-reconciliation-paused.js';
|
|
13
14
|
import { useRestartConfirm } from './use-restart-confirm.js';
|
|
14
|
-
// Helper to translate with fallback
|
|
15
|
-
function safeTranslate(translateFn, key, fallback, options) {
|
|
16
|
-
try {
|
|
17
|
-
const result = translateFn(key, options);
|
|
18
|
-
const keyWithoutNamespace = key.includes(':')
|
|
19
|
-
? key.split(':').slice(1).join(':')
|
|
20
|
-
: key;
|
|
21
|
-
if (result === key || result === keyWithoutNamespace) {
|
|
22
|
-
return fallback;
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return fallback;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
15
|
function renderStrongTextTranslation(translateFn, key, fallback, options) {
|
|
31
16
|
const text = safeTranslate(translateFn, key, fallback, options);
|
|
32
17
|
let offset = 0;
|