@camunda/ccma-saas-frontend 0.10.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 +40 -9
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +17 -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 +12 -1
- package/lib/esm/i18n/en/pages/clusters.json +1 -0
- 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/c4-console-runtime-context.d.ts +7 -0
- package/lib/esm/runtime/c4-console-runtime-context.js +130 -2
- package/lib/esm/runtime/c4-console-runtime.types.d.ts +22 -0
- package/lib/esm/runtime/cluster-creation-blocked.d.ts +16 -0
- package/lib/esm/runtime/cluster-creation-blocked.js +21 -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 +31 -29
- 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 +99 -103
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +9 -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 +10 -24
- 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
|
@@ -145,7 +145,8 @@
|
|
|
145
145
|
"fields": {
|
|
146
146
|
"name": {
|
|
147
147
|
"label": "Client name",
|
|
148
|
-
"helperText": "can contain letters, dashes, underscores, and digits"
|
|
148
|
+
"helperText": "can contain letters, dashes, underscores, and digits",
|
|
149
|
+
"required": "Client name is required"
|
|
149
150
|
}
|
|
150
151
|
},
|
|
151
152
|
"error": {
|
|
@@ -93,7 +93,12 @@
|
|
|
93
93
|
"operateUrl": "Operate URL",
|
|
94
94
|
"optimizeUrl": "Optimize URL",
|
|
95
95
|
"oauthUrl": "OAuth URL",
|
|
96
|
-
"restApi": "Camunda REST API"
|
|
96
|
+
"restApi": "Camunda REST API",
|
|
97
|
+
"error": {
|
|
98
|
+
"title": "Something went wrong",
|
|
99
|
+
"cluster": "Failed to load cluster.",
|
|
100
|
+
"clients": "Failed to load clients."
|
|
101
|
+
}
|
|
97
102
|
},
|
|
98
103
|
"fetchError": {
|
|
99
104
|
"title": "Oops ... something went wrong.",
|
|
@@ -147,6 +152,11 @@
|
|
|
147
152
|
"title": "Store credentials safely using Camunda cluster secrets",
|
|
148
153
|
"description": "Accessing an external system requires authentication with credentials. To ensure the credentials are secure, use the Camunda secrets vault to store usernames, passwords, or API credentials without exposing sensitive information in your BPMN processes."
|
|
149
154
|
},
|
|
155
|
+
"noSecretsDs": {
|
|
156
|
+
"title": "Store sensitive values as cluster secrets",
|
|
157
|
+
"description": "Cluster secrets store API keys, passwords, and other sensitive values. Reference them from credentials and supported fields.",
|
|
158
|
+
"link": "Learn more about cluster secrets"
|
|
159
|
+
},
|
|
150
160
|
"forbidden": {
|
|
151
161
|
"title": "You don't have access to cluster secrets",
|
|
152
162
|
"description": "You don't have permission to view cluster secrets for this cluster. Contact an organization owner or admin for access."
|
|
@@ -373,6 +383,7 @@
|
|
|
373
383
|
"label": "Status",
|
|
374
384
|
"wakeLabel": "Resume cluster",
|
|
375
385
|
"wakeDisabledFailoverSource": "This cluster was failed over and can no longer be resumed.",
|
|
386
|
+
"wakeDisabledRetiredAlpha": "This alpha generation is not supported anymore.",
|
|
376
387
|
"sleepLabel": "Suspend cluster (internal)",
|
|
377
388
|
"waitingForInputTooltip": "Waiting for external encryption to be configured",
|
|
378
389
|
"wakeError": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"delete": "Delete",
|
|
35
35
|
"resume": "Resume",
|
|
36
36
|
"resumeUnavailableFailoverSource": "Resume (unavailable — this cluster was failed over)",
|
|
37
|
+
"resumeUnavailableRetiredAlpha": "Resume (unavailable — this generation has a known defect)",
|
|
37
38
|
"failover": "Failover",
|
|
38
39
|
"failoverSyncPending": "Failover (unavailable until backup data is synced to the secondary region)",
|
|
39
40
|
"failoverAlreadyFailedOver": "Failover (unavailable — this cluster was already failed over)"
|
|
@@ -89,5 +89,48 @@
|
|
|
89
89
|
"prefix": "Need help?",
|
|
90
90
|
"label": "Talk to an expert"
|
|
91
91
|
}
|
|
92
|
+
},
|
|
93
|
+
"duplicate": {
|
|
94
|
+
"title": "Duplicate a cluster",
|
|
95
|
+
"notice": {
|
|
96
|
+
"title": "Copying settings from",
|
|
97
|
+
"copied": "Your connector secrets, alerts, IP allowlist, and other cluster settings carry over to the new cluster.",
|
|
98
|
+
"notCopied": "Process data is not copied — the new cluster starts empty. Each API client is recreated with a new client ID and secret, so update your applications with the new credentials."
|
|
99
|
+
},
|
|
100
|
+
"cta": {
|
|
101
|
+
"create": "Duplicate cluster",
|
|
102
|
+
"states": {
|
|
103
|
+
"submitting": "Duplicating cluster...",
|
|
104
|
+
"success": "Cluster will now be created",
|
|
105
|
+
"error": "Error duplicating cluster. Please try again."
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"replace": {
|
|
109
|
+
"label": "Delete the original cluster to free up a reservation",
|
|
110
|
+
"description": "Your plan has no reservations left. The new cluster is created first, then the original cluster and all of its data are deleted. This cannot be undone.",
|
|
111
|
+
"confirm": {
|
|
112
|
+
"heading": "Delete the original cluster?",
|
|
113
|
+
"body": "The original cluster and all of its data are deleted once the new cluster is created. This cannot be undone.",
|
|
114
|
+
"label": "Type DELETE to confirm",
|
|
115
|
+
"primary": "Duplicate and delete",
|
|
116
|
+
"secondary": "Cancel"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"carryOverFailed": {
|
|
120
|
+
"title": "Some settings were not copied",
|
|
121
|
+
"subtitle": "Your new cluster is ready, but we could not copy everything. Check these on the new cluster:"
|
|
122
|
+
},
|
|
123
|
+
"carryOver": {
|
|
124
|
+
"clusterClients": "API clients",
|
|
125
|
+
"connectorSecrets": "connector secrets",
|
|
126
|
+
"alerts": "alerts",
|
|
127
|
+
"byom": "monitoring credentials",
|
|
128
|
+
"byoidp": "identity provider secret",
|
|
129
|
+
"backupSchedule": "backup schedule"
|
|
130
|
+
},
|
|
131
|
+
"sourceNotDeleted": {
|
|
132
|
+
"title": "The original cluster was not deleted",
|
|
133
|
+
"subtitle": "Your new cluster is ready, but we could not delete the original cluster. Delete it from the cluster list to free up its reservation."
|
|
134
|
+
}
|
|
92
135
|
}
|
|
93
136
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export { C4ExternalLink } from './components/c4-external-link/c4-external-link.j
|
|
|
102
102
|
export type { C4ExternalLinkProps } from './components/c4-external-link/c4-external-link.types.js';
|
|
103
103
|
export type { C4FeedbackFormProps, C4FeedbackModalProps, C4FeedbackPayload, C4FeedbackReportType, } from './components/c4-feedback-modal/c4-feedback-modal.js';
|
|
104
104
|
export { C4FeedbackForm, C4FeedbackModal, } from './components/c4-feedback-modal/c4-feedback-modal.js';
|
|
105
|
+
export { C4FileUploader, type C4FileUploaderProps, } from './components/c4-file-uploader/c4-file-uploader.js';
|
|
105
106
|
export type { C4HelpCenterData, C4HelpCenterLink, C4HelpCenterProps, C4HelpCenterTabData, C4HelpCenterTile, } from './components/c4-help-center/c4-help-center.js';
|
|
106
107
|
export { C4HelpCenter, FEEDBACK_TAB_ID, } from './components/c4-help-center/c4-help-center.js';
|
|
107
108
|
export { HUB_HELP_CENTER_LINKS_FLAG, rewriteAppHostToHub, } from './components/c4-help-center/help-center-app-host.js';
|
|
@@ -158,6 +159,7 @@ export { C4Search } from './components/c4-search/c4-search.js';
|
|
|
158
159
|
export type { C4SearchProps } from './components/c4-search/c4-search.types.js';
|
|
159
160
|
export { C4SearchResults } from './components/c4-search/c4-search-results.js';
|
|
160
161
|
export type { C4SearchResultsProps, SearchResultEntry, SearchResults, } from './components/c4-search/c4-search-results.types.js';
|
|
162
|
+
export { C4SegmentedControl, type C4SegmentedControlOption, type C4SegmentedControlProps, } from './components/c4-segmented-control/c4-segmented-control.js';
|
|
161
163
|
export { C4SmClusterDetails } from './components/c4-sm-cluster-details/c4-sm-cluster-details.js';
|
|
162
164
|
export type { C4SmClusterDetailsProps } from './components/c4-sm-cluster-details/c4-sm-cluster-details.types.js';
|
|
163
165
|
export { C4SmDashboard } from './components/c4-sm-dashboard/c4-sm-dashboard.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -55,6 +55,7 @@ export { C4EmptyState, } from './components/c4-empty-state/c4-empty-state.js';
|
|
|
55
55
|
export { C4ExtendTrialModal } from './components/c4-extend-trial-modal/c4-extend-trial-modal.js';
|
|
56
56
|
export { C4ExternalLink } from './components/c4-external-link/c4-external-link.js';
|
|
57
57
|
export { C4FeedbackForm, C4FeedbackModal, } from './components/c4-feedback-modal/c4-feedback-modal.js';
|
|
58
|
+
export { C4FileUploader, } from './components/c4-file-uploader/c4-file-uploader.js';
|
|
58
59
|
export { C4HelpCenter, FEEDBACK_TAB_ID, } from './components/c4-help-center/c4-help-center.js';
|
|
59
60
|
export { HUB_HELP_CENTER_LINKS_FLAG, rewriteAppHostToHub, } from './components/c4-help-center/help-center-app-host.js';
|
|
60
61
|
export { C4InfoTooltip } from './components/c4-info-tooltip/c4-info-tooltip.js';
|
|
@@ -85,6 +86,7 @@ export { C4PricingCard } from './components/c4-pricing-card/c4-pricing-card.js';
|
|
|
85
86
|
export { C4RenameOrganizationModal } from './components/c4-rename-organization-modal/c4-rename-organization-modal.js';
|
|
86
87
|
export { C4Search } from './components/c4-search/c4-search.js';
|
|
87
88
|
export { C4SearchResults } from './components/c4-search/c4-search-results.js';
|
|
89
|
+
export { C4SegmentedControl, } from './components/c4-segmented-control/c4-segmented-control.js';
|
|
88
90
|
export { C4SmClusterDetails } from './components/c4-sm-cluster-details/c4-sm-cluster-details.js';
|
|
89
91
|
export { C4SmDashboard } from './components/c4-sm-dashboard/c4-sm-dashboard.js';
|
|
90
92
|
export { C4Stat } from './components/c4-stat/c4-stat.js';
|
|
@@ -31,5 +31,12 @@ export declare const useC4ConsoleStage: () => ConsoleStage | undefined;
|
|
|
31
31
|
*
|
|
32
32
|
* The key is the dot path of the flag in `@camunda-cloud/featureflags`, for
|
|
33
33
|
* example `console.optionalTelemetry`.
|
|
34
|
+
*
|
|
35
|
+
* The value comes from one of two places. A host that gives
|
|
36
|
+
* `config.featureFlags` answers it itself. Every other host gets the flags
|
|
37
|
+
* that `C4ConsoleRuntimeProvider` reads from accounts-backend. That read is a
|
|
38
|
+
* request, thus a flag is off on the first render and the component renders
|
|
39
|
+
* again when the flags arrive. Do not use this hook for a one-time effect that
|
|
40
|
+
* must not run twice.
|
|
34
41
|
*/
|
|
35
42
|
export declare const useC4FeatureFlag: (flagKey: string) => boolean;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { ExternalAccountsService } from '@camunda/ccma-api';
|
|
8
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
9
|
+
import { toApiConfig } from './to-api-config.js';
|
|
3
10
|
const RuntimeContext = createContext(undefined);
|
|
4
11
|
// Carbon dark theme names (set by c3 on <html data-carbon-theme>).
|
|
5
12
|
const CARBON_DARK_THEMES = new Set(['g90', 'g100']);
|
|
@@ -40,9 +47,123 @@ function useSyncCarbonThemeToDesignSystem(designSystem) {
|
|
|
40
47
|
};
|
|
41
48
|
}, [designSystem]);
|
|
42
49
|
}
|
|
50
|
+
/** Reads a dot path such as `console.optionalTelemetry` out of the flags. */
|
|
51
|
+
function readFlag(flags, flagKey) {
|
|
52
|
+
if (!flags) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
let value = flags;
|
|
56
|
+
for (const part of flagKey.split('.')) {
|
|
57
|
+
if (part.length === 0 || typeof value !== 'object' || value === null) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
value = value[part];
|
|
61
|
+
}
|
|
62
|
+
return value === true;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Reads the flags of the caller from accounts-backend, one time per
|
|
66
|
+
* organization and user.
|
|
67
|
+
*
|
|
68
|
+
* It fetches nothing when the host gives `config.featureFlags`, thus a host
|
|
69
|
+
* that evaluates the flags itself makes no request. It also fetches nothing
|
|
70
|
+
* without an access token: the provider is mounted app-wide, and an anonymous
|
|
71
|
+
* route (`/login`, a public share link) must not send a request that gets a
|
|
72
|
+
* 401. In both cases every flag reads as off, which is the same default as a
|
|
73
|
+
* tree with no provider.
|
|
74
|
+
*
|
|
75
|
+
* A host that wants the fetched flags must give `config.user`. The effect runs
|
|
76
|
+
* again on a change of the stage, the organization, the user or the accounts
|
|
77
|
+
* URL. A login changes the user, thus the flags arrive. A host that gives no
|
|
78
|
+
* `user` and keeps one `orgId` (an org id from the URL is there on an
|
|
79
|
+
* anonymous route too) changes none of them at the login, thus its flags stay
|
|
80
|
+
* off. A warning says so in a development build.
|
|
81
|
+
*/
|
|
82
|
+
function useFetchedFeatureFlags(config) {
|
|
83
|
+
const [flags, setFlags] = useState(undefined);
|
|
84
|
+
// The host usually gives `config` as an object literal, thus its identity
|
|
85
|
+
// changes on every render. The effect below must depend on primitives alone,
|
|
86
|
+
// or it fetches in a loop.
|
|
87
|
+
const configRef = useRef(config);
|
|
88
|
+
configRef.current = config;
|
|
89
|
+
const hostOwnsFlags = Boolean(config.featureFlags);
|
|
90
|
+
const { stage, orgId } = config;
|
|
91
|
+
const email = config.user?.email;
|
|
92
|
+
// The identity of the session. It makes the effect run again after a login,
|
|
93
|
+
// which is the point at which an access token starts to exist.
|
|
94
|
+
const userId = config.user?.sub;
|
|
95
|
+
const accountsApiBaseUrl = config.backendUrls.accountsApiBaseUrl;
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (hostOwnsFlags) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Drop the flags of the previous organization and user before the request.
|
|
101
|
+
// Otherwise the old values answer until the new values arrive, thus an
|
|
102
|
+
// allowlist flag such as `console.privateLink87` shows a feature that the
|
|
103
|
+
// new organization must not get. A request that never settles would keep
|
|
104
|
+
// the old values for the life of the page.
|
|
105
|
+
setFlags(undefined);
|
|
106
|
+
let cancelled = false;
|
|
107
|
+
const load = async () => {
|
|
108
|
+
try {
|
|
109
|
+
const runtime = configRef.current;
|
|
110
|
+
const token = await runtime.auth.getAccessToken();
|
|
111
|
+
if (cancelled || !token) {
|
|
112
|
+
if (!token &&
|
|
113
|
+
!runtime.user &&
|
|
114
|
+
process.env.NODE_ENV !== 'production') {
|
|
115
|
+
console.warn('[c4] C4ConsoleRuntimeProvider found no access token and no `config.user`. ' +
|
|
116
|
+
'Give `config.user` when the session starts, or the feature flags stay off. ' +
|
|
117
|
+
'See docs/runtime.md section 4a.');
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const fetched = await ExternalAccountsService.getFeatureFlags({
|
|
122
|
+
// The token above is current, thus the request reuses it. A second
|
|
123
|
+
// call to `getAccessToken` of the host is not necessary.
|
|
124
|
+
config: {
|
|
125
|
+
...toApiConfig(runtime),
|
|
126
|
+
auth: { getToken: async () => token },
|
|
127
|
+
},
|
|
128
|
+
params: { orgId },
|
|
129
|
+
});
|
|
130
|
+
if (!cancelled) {
|
|
131
|
+
setFlags(fetched);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (!cancelled) {
|
|
136
|
+
// Every flag stays off. A flag holds the behavior that a host must
|
|
137
|
+
// not get by default, thus off is the safe answer.
|
|
138
|
+
setFlags(undefined);
|
|
139
|
+
configRef.current.telemetry?.captureException?.(error, {
|
|
140
|
+
source: 'C4ConsoleRuntimeProvider.featureFlags',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
void load();
|
|
146
|
+
return () => {
|
|
147
|
+
cancelled = true;
|
|
148
|
+
};
|
|
149
|
+
}, [hostOwnsFlags, stage, orgId, email, userId, accountsApiBaseUrl]);
|
|
150
|
+
return flags;
|
|
151
|
+
}
|
|
43
152
|
export const C4ConsoleRuntimeProvider = ({ config, children, }) => {
|
|
44
153
|
useSyncCarbonThemeToDesignSystem(config.designSystem ?? 'carbon');
|
|
45
|
-
|
|
154
|
+
const fetchedFlags = useFetchedFeatureFlags(config);
|
|
155
|
+
const value = useMemo(() => {
|
|
156
|
+
if (config.featureFlags) {
|
|
157
|
+
return config;
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
...config,
|
|
161
|
+
featureFlags: {
|
|
162
|
+
isEnabled: (flagKey) => readFlag(fetchedFlags, flagKey),
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}, [config, fetchedFlags]);
|
|
166
|
+
return (_jsx(RuntimeContext.Provider, { value: value, children: children }));
|
|
46
167
|
};
|
|
47
168
|
export const useC4ConsoleRuntime = () => {
|
|
48
169
|
const runtime = useContext(RuntimeContext);
|
|
@@ -80,6 +201,13 @@ export const useC4ConsoleStage = () => {
|
|
|
80
201
|
*
|
|
81
202
|
* The key is the dot path of the flag in `@camunda-cloud/featureflags`, for
|
|
82
203
|
* example `console.optionalTelemetry`.
|
|
204
|
+
*
|
|
205
|
+
* The value comes from one of two places. A host that gives
|
|
206
|
+
* `config.featureFlags` answers it itself. Every other host gets the flags
|
|
207
|
+
* that `C4ConsoleRuntimeProvider` reads from accounts-backend. That read is a
|
|
208
|
+
* request, thus a flag is off on the first render and the component renders
|
|
209
|
+
* again when the flags arrive. Do not use this hook for a one-time effect that
|
|
210
|
+
* must not run twice.
|
|
83
211
|
*/
|
|
84
212
|
export const useC4FeatureFlag = (flagKey) => {
|
|
85
213
|
return useContext(RuntimeContext)?.featureFlags?.isEnabled?.(flagKey) ?? false;
|
|
@@ -52,6 +52,14 @@ export interface C4ConsoleRuntimeConfig {
|
|
|
52
52
|
designSystem?: C4DesignSystem;
|
|
53
53
|
auth: ConsoleAuth;
|
|
54
54
|
backendUrls: ConsoleBackendUrls;
|
|
55
|
+
/**
|
|
56
|
+
* The organization that the host shows at this time. It selects the
|
|
57
|
+
* org-scoped feature flags, thus give it when the host knows the
|
|
58
|
+
* organization. The user must be a member of it.
|
|
59
|
+
*
|
|
60
|
+
* A host that gives `featureFlags` does not need this field.
|
|
61
|
+
*/
|
|
62
|
+
orgId?: string;
|
|
55
63
|
publicUrls?: ConsolePublicUrls;
|
|
56
64
|
user?: ConsoleUser;
|
|
57
65
|
clickwrap?: ConsoleClickwrapConfig;
|
|
@@ -59,6 +67,20 @@ export interface C4ConsoleRuntimeConfig {
|
|
|
59
67
|
i18n?: {
|
|
60
68
|
t: (key: string, options?: Record<string, unknown>) => string;
|
|
61
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Overrides the feature flags of the host.
|
|
72
|
+
*
|
|
73
|
+
* Omit it and `C4ConsoleRuntimeProvider` reads the flags from
|
|
74
|
+
* `GET external/feature-flags` on accounts-backend. Thus the deployed
|
|
75
|
+
* backend owns the values, and the host holds no copy of the rules. This is
|
|
76
|
+
* the path for an external host such as Camunda Hub.
|
|
77
|
+
*
|
|
78
|
+
* Give it and the fetch does not happen, and this function answers every
|
|
79
|
+
* flag. console-frontend does this: it imports `@camunda-cloud/featureflags`
|
|
80
|
+
* and evaluates the flags in the browser. It is also the only host in this
|
|
81
|
+
* repository that mounts this provider — the control and accounts frontends
|
|
82
|
+
* read `features()` directly and never come through here.
|
|
83
|
+
*/
|
|
62
84
|
featureFlags?: {
|
|
63
85
|
isEnabled: (flagKey: string) => boolean;
|
|
64
86
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flag that blocks new clusters and generation updates. Every create button
|
|
3
|
+
* and the update button of this package read it, thus one name holds the dot
|
|
4
|
+
* path.
|
|
5
|
+
*
|
|
6
|
+
* A generation update makes the same new workloads as a new cluster. Thus one
|
|
7
|
+
* flag stops both. The name speaks of creation only, because the flag is older
|
|
8
|
+
* than the update block.
|
|
9
|
+
*
|
|
10
|
+
* The button stays visible and gives no reason, because the user cannot change
|
|
11
|
+
* the block. console-backend answers 503 for the same flag, in
|
|
12
|
+
* `createNewCluster` and in `upgradeGenerationForCluster`. A host that does not
|
|
13
|
+
* know the flag reads it as off (see `useC4FeatureFlag`), thus the buttons work
|
|
14
|
+
* as before.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CLUSTER_CREATION_BLOCKED_FLAG = "console.clusterCreationBlocked";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The flag that blocks new clusters and generation updates. Every create button
|
|
8
|
+
* and the update button of this package read it, thus one name holds the dot
|
|
9
|
+
* path.
|
|
10
|
+
*
|
|
11
|
+
* A generation update makes the same new workloads as a new cluster. Thus one
|
|
12
|
+
* flag stops both. The name speaks of creation only, because the flag is older
|
|
13
|
+
* than the update block.
|
|
14
|
+
*
|
|
15
|
+
* The button stays visible and gives no reason, because the user cannot change
|
|
16
|
+
* the block. console-backend answers 503 for the same flag, in
|
|
17
|
+
* `createNewCluster` and in `upgradeGenerationForCluster`. A host that does not
|
|
18
|
+
* know the flag reads it as off (see `useC4FeatureFlag`), thus the buttons work
|
|
19
|
+
* as before.
|
|
20
|
+
*/
|
|
21
|
+
export const CLUSTER_CREATION_BLOCKED_FLAG = 'console.clusterCreationBlocked';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flag that offers a duplicate of a cluster. The create page and every menu
|
|
3
|
+
* that opens it read this flag, thus one name holds the dot path.
|
|
4
|
+
*
|
|
5
|
+
* console-backend answers 501 for the same flag, on
|
|
6
|
+
* `POST /orgs/:orgId/clusters/:clusterId/duplicate`. A host that does not know
|
|
7
|
+
* the flag reads it as off (see `useC4FeatureFlag`), thus no menu shows the
|
|
8
|
+
* entry and the create page makes a normal cluster.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLUSTER_DUPLICATION_FLAG = "console.clusterDuplication";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The flag that offers a duplicate of a cluster. The create page and every menu
|
|
8
|
+
* that opens it read this flag, thus one name holds the dot path.
|
|
9
|
+
*
|
|
10
|
+
* console-backend answers 501 for the same flag, on
|
|
11
|
+
* `POST /orgs/:orgId/clusters/:clusterId/duplicate`. A host that does not know
|
|
12
|
+
* the flag reads it as off (see `useC4FeatureFlag`), thus no menu shows the
|
|
13
|
+
* entry and the create page makes a normal cluster.
|
|
14
|
+
*/
|
|
15
|
+
export const CLUSTER_DUPLICATION_FLAG = 'console.clusterDuplication';
|
|
@@ -91,5 +91,5 @@ export function C4PasswordInput({ className, defaultValue, disabled, helperText,
|
|
|
91
91
|
return (_jsxs("div", { className: 'flex flex-col gap-1', children: [labelText !== undefined ? (_jsx("label", { htmlFor: resolvedId, className: cn('text-sm font-medium', hideLabel && 'sr-only'), children: labelText })) : null, _jsxs("div", { className: 'relative', children: [_jsx(Input, { ...omitCarbonOnly(rest), ...valueProps, id: resolvedId, type: inputType, disabled: disabled, readOnly: readOnly, placeholder: placeholder, onChange: onChange, onClick: onClick, "aria-invalid": invalid || undefined, "aria-errormessage": errorMessageId, "aria-describedby": describedBy, className: cn('pr-8', className) }), _jsx("button", { type: 'button', "aria-label": passwordIsVisible ? hidePasswordLabel : showPasswordLabel, disabled: disabled, onClick: (event) => {
|
|
92
92
|
setInputType(passwordIsVisible ? 'password' : 'text');
|
|
93
93
|
onTogglePasswordVisibility?.(event);
|
|
94
|
-
}, className: 'absolute right-2 top-1/2 -translate-y-1/2 rounded-sm text-neutral-foreground-subtle hover:text-neutral-foreground-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50', children: _jsx(ToggleIcon, { "aria-hidden": 'true', className: 'h-4 w-4' }) })] }), showInvalidText ? (_jsx("span", { id: errorId, className: 'text-xs text-danger-
|
|
94
|
+
}, className: 'absolute right-2 top-1/2 -translate-y-1/2 rounded-sm text-neutral-foreground-subtle hover:text-neutral-foreground-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50', children: _jsx(ToggleIcon, { "aria-hidden": 'true', className: 'h-4 w-4' }) })] }), showInvalidText ? (_jsx("span", { id: errorId, className: 'text-xs text-danger-foreground-subtle', children: invalidText })) : null, showHelperText ? (_jsx("span", { id: helperId, className: 'text-xs text-neutral-foreground-subtle', children: helperText })) : null] }));
|
|
95
95
|
}
|
package/lib/esm/ui/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type ComponentProps, type ComponentType } from 'react';
|
|
|
3
3
|
export declare const Button: ComponentType<import("@camunda/design-system/carbon-compat").ButtonProps<"button">>;
|
|
4
4
|
export declare const Checkbox: ComponentType<import("@carbon/react").CheckboxProps & import("react").RefAttributes<unknown>>;
|
|
5
5
|
export declare const CodeSnippet: ComponentType<import("@camunda/design-system/carbon-compat").CodeSnippetProps>;
|
|
6
|
+
export declare const ClusterTag: ComponentType<import("@camunda/design-system/carbon-compat").C3ClusterTagProps>;
|
|
6
7
|
export declare const DefinitionTooltip: ComponentType<import("@carbon/react").DefinitionTooltipProps>;
|
|
7
8
|
export declare const Dropdown: ComponentType<import("@carbon/react").DropdownProps<unknown> & {
|
|
8
9
|
ref?: import("react").Ref<HTMLButtonElement>;
|
package/lib/esm/ui/index.js
CHANGED
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
* To add a leaf: import the Carbon + carbon-compat versions and wrap with
|
|
37
37
|
* `switchable(...)`, then point the consuming component's import at this module.
|
|
38
38
|
*/
|
|
39
|
-
import {
|
|
39
|
+
import { C3ClusterTag as CarbonClusterTag } from '@camunda/camunda-composite-components';
|
|
40
|
+
import { BreadcrumbSkeleton as DsBreadcrumbSkeleton, Button as DsButton, Checkbox as DsCheckbox, C3ClusterTag as DsClusterTag, CodeSnippet as DsCodeSnippet, ComposedModal as DsComposedModal, Dropdown as DsDropdown, FilterableMultiSelect as DsFilterableMultiSelect, Form as DsForm, FormGroup as DsFormGroup, IconButton as DsIconButton, Link as DsLink, ListItem as DsListItem, Loading as DsLoading, ModalBody as DsModalBody, ModalFooter as DsModalFooter, ModalHeader as DsModalHeader, MultiSelect as DsMultiSelect, OverflowMenu as DsOverflowMenu, OverflowMenuItem as DsOverflowMenuItem, ProgressBar as DsProgressBar, Search as DsSearch, SkeletonPlaceholder as DsSkeletonPlaceholder, SkeletonText as DsSkeletonText, Stack as DsStack, TabsSkeleton as DsTabsSkeleton, Tag as DsTag, TextArea as DsTextArea, TextInput as DsTextInput, Tile as DsTile, Toggle as DsToggle, Tooltip as DsTooltip, UnorderedList as DsUnorderedList, } from '@camunda/design-system/carbon-compat';
|
|
40
41
|
import { BreadcrumbSkeleton as CarbonBreadcrumbSkeleton, Button as CarbonButton, Checkbox as CarbonCheckbox, CodeSnippet as CarbonCodeSnippet, ComposedModal as CarbonComposedModal, DefinitionTooltip as CarbonDefinitionTooltip, Dropdown as CarbonDropdown, FilterableMultiSelect as CarbonFilterableMultiSelect, Form as CarbonForm, FormGroup as CarbonFormGroup, IconButton as CarbonIconButton, Link as CarbonLink, ListItem as CarbonListItem, Loading as CarbonLoading, Modal as CarbonModal, ModalBody as CarbonModalBody, ModalFooter as CarbonModalFooter, ModalHeader as CarbonModalHeader, MultiSelect as CarbonMultiSelect, OverflowMenu as CarbonOverflowMenu, OverflowMenuItem as CarbonOverflowMenuItem, PasswordInput as CarbonPasswordInput, ProgressBar as CarbonProgressBar, Search as CarbonSearch, SkeletonPlaceholder as CarbonSkeletonPlaceholder, SkeletonText as CarbonSkeletonText, Stack as CarbonStack, TabsSkeleton as CarbonTabsSkeleton, Tag as CarbonTag, TextArea as CarbonTextArea, TextInput as CarbonTextInput, Tile as CarbonTile, Toggle as CarbonToggle, Tooltip as CarbonTooltip, UnorderedList as CarbonUnorderedList, } from '@carbon/react';
|
|
41
42
|
import { createElement, Fragment, } from 'react';
|
|
42
43
|
import { useC4DesignSystem } from '../runtime/c4-console-runtime-context.js';
|
|
@@ -47,6 +48,13 @@ import { switchable } from './switchable.js';
|
|
|
47
48
|
export const Button = switchable(CarbonButton, DsButton);
|
|
48
49
|
export const Checkbox = switchable(CarbonCheckbox, DsCheckbox);
|
|
49
50
|
export const CodeSnippet = switchable(CarbonCodeSnippet, DsCodeSnippet);
|
|
51
|
+
// The c3 stage chip. c3 is public and renders the Carbon `Tag` itself, thus the
|
|
52
|
+
// ds branch is the carbon-compat adapter, which renders the DS `Badge` and
|
|
53
|
+
// gives each stage a semantic variant (dev/test/stage/prod →
|
|
54
|
+
// success/info/warning/danger). The adapter supports the `stage` form alone:
|
|
55
|
+
// it drops `clusterUuid` with a warning, because it cannot read the c3 profile
|
|
56
|
+
// store. Look the stage up at the call site before you pass it.
|
|
57
|
+
export const ClusterTag = switchable(CarbonClusterTag, DsClusterTag);
|
|
50
58
|
// carbon-compat ships no definition-tooltip adapter, so the ds branch is the DS
|
|
51
59
|
// component directly (see ./c4-definition-tooltip). Unlike Carbon's, it renders
|
|
52
60
|
// the definition through a portal, so an ancestor that hides overflow does not
|
|
@@ -97,6 +105,12 @@ export const Tag = switchable(CarbonTag, DsTag);
|
|
|
97
105
|
// TextInput adapter, which DOES render them: append a helper/error `<span>`
|
|
98
106
|
// sibling after the DS TextArea, with the same classes and error-over-helper
|
|
99
107
|
// precedence. Carbon mode stays byte-identical.
|
|
108
|
+
//
|
|
109
|
+
// The error class must be one that the DS stylesheet holds. A c4 consumer
|
|
110
|
+
// loads the built `@camunda/design-system/styles.css` and compiles no Tailwind
|
|
111
|
+
// of its own, thus a utility class that no DS component uses has no rule, and
|
|
112
|
+
// the error text then renders in the normal color. `text-danger-foreground-
|
|
113
|
+
// subtle` is the class of the DS TextInput adapter, so it is always there.
|
|
100
114
|
function C4TextArea(props) {
|
|
101
115
|
const designSystem = useC4DesignSystem();
|
|
102
116
|
if (designSystem !== 'ds') {
|
|
@@ -109,7 +123,7 @@ function C4TextArea(props) {
|
|
|
109
123
|
const { invalid, invalidText, helperText, ...dsProps } = props;
|
|
110
124
|
let message;
|
|
111
125
|
if (invalid && invalidText !== undefined) {
|
|
112
|
-
message = createElement('span', { className: 'text-xs text-danger-
|
|
126
|
+
message = createElement('span', { className: 'text-xs text-danger-foreground-subtle' }, invalidText);
|
|
113
127
|
}
|
|
114
128
|
else if (helperText !== undefined) {
|
|
115
129
|
message = createElement('span', { className: 'text-xs text-neutral-foreground-subtle' }, helperText);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AssignableOrganizationRoleType } from '@camunda/ccma-shared-types';
|
|
2
|
-
type TranslateFn
|
|
2
|
+
import { type TranslateFn } from './safe-translate.js';
|
|
3
3
|
/** The 8.7-cluster legacy section, minus anything the aligned model promotes. */
|
|
4
4
|
export declare function legacySectionRoles(permissionsReworkEnabled: boolean): AssignableOrganizationRoleType[];
|
|
5
5
|
/**
|
|
@@ -35,4 +35,3 @@ export declare function roleLabelDescription(t: TranslateFn | undefined, role: s
|
|
|
35
35
|
label: string;
|
|
36
36
|
description: string;
|
|
37
37
|
};
|
|
38
|
-
export {};
|
|
@@ -4,19 +4,7 @@
|
|
|
4
4
|
* You may not use this file except in compliance with the commercial license.
|
|
5
5
|
*/
|
|
6
6
|
import { LegacyHeldOrganizationRole, OrganizationRole, } from '@camunda/ccma-shared-types';
|
|
7
|
-
|
|
8
|
-
if (!t)
|
|
9
|
-
return defaultValue;
|
|
10
|
-
try {
|
|
11
|
-
const translated = t(key);
|
|
12
|
-
return typeof translated === 'string' && translated !== key
|
|
13
|
-
? translated
|
|
14
|
-
: defaultValue;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return defaultValue;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
7
|
+
import { safeTranslate } from './safe-translate.js';
|
|
20
8
|
// Historical UI order of the 8.7-cluster roles section.
|
|
21
9
|
const LEGACY_SECTION_ROLES = [
|
|
22
10
|
OrganizationRole.VISITOR,
|
|
@@ -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
|
}
|
|
@@ -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) {
|