@camunda/ccma-saas-frontend 0.7.1 → 0.8.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-breadcrumb/c4-breadcrumb.d.ts +1 -1
- package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.js +9 -5
- package/lib/esm/components/c4-breadcrumb/c4-breadcrumb.types.d.ts +6 -0
- package/lib/esm/components/c4-cluster-details-activity/c4-cluster-details-activity.js +2 -1
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +9 -0
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.js +6 -3
- package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.types.d.ts +3 -0
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.js +9 -0
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.mocks.js +2 -0
- package/lib/esm/components/c4-cluster-details-connector-secrets/c4-cluster-details-connector-secrets.types.d.ts +2 -0
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.d.ts +1 -1
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.js +19 -21
- package/lib/esm/components/c4-cluster-details-encryption/c4-cluster-details-encryption.types.d.ts +19 -2
- package/lib/esm/components/c4-cluster-details-hot-backups/c4-cluster-details-hot-backups.js +4 -3
- package/lib/esm/components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js +2 -1
- 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 +6 -4
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +7 -0
- package/lib/esm/components/c4-cluster-overview/applications.d.ts +20 -0
- package/lib/esm/components/c4-cluster-overview/applications.js +37 -24
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.d.ts +1 -1
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.js +5 -5
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.mocks.d.ts +6 -1
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.mocks.js +15 -2
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.types.d.ts +10 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.d.ts +7 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.js +5 -2
- package/lib/esm/components/c4-cluster-overview/cluster-load.d.ts +8 -0
- package/lib/esm/components/c4-cluster-overview/cluster-load.js +20 -8
- 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 +4 -2
- package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +4 -0
- package/lib/esm/components/c4-cluster-settings/elements/cluster-settings.d.ts +3 -1
- package/lib/esm/components/c4-cluster-settings/elements/cluster-settings.js +7 -3
- package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +2 -1
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.d.ts +9 -1
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider-modal.js +69 -12
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.d.ts +10 -1
- package/lib/esm/components/c4-cluster-settings/elements/external-identity-provider.js +16 -2
- package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.d.ts +14 -0
- package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.js +12 -0
- package/lib/esm/components/c4-cluster-settings/elements/secrets-filter-mode-toggle.d.ts +15 -0
- package/lib/esm/components/c4-cluster-settings/elements/secrets-filter-mode-toggle.js +10 -0
- package/lib/esm/components/c4-cluster-settings/elements/settings-tile.js +2 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-tile-grid.d.ts +4 -2
- package/lib/esm/components/c4-create-cluster/c4-create-cluster-tile-grid.js +24 -3
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +1 -1
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.mocks.js +1 -0
- package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +2 -0
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.d.ts +1 -1
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.js +2 -2
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.mocks.js +10 -5
- package/lib/esm/components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.types.d.ts +10 -0
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-chart-heading.js +2 -1
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-error-table.js +3 -2
- package/lib/esm/components/c4-job-dashboard-details-page/elements/c4-job-dashboard-worker-table.js +3 -2
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.d.ts +1 -1
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.js +7 -2
- package/lib/esm/components/c4-job-dashboard-entry-point/c4-job-dashboard-entry-point.types.d.ts +8 -0
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.d.ts +1 -1
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.js +2 -2
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.mocks.js +10 -5
- package/lib/esm/components/c4-job-dashboard-overview-page/c4-job-dashboard-overview.types.d.ts +10 -0
- package/lib/esm/components/c4-job-dashboard-shared/c4-job-dashboard-error-handler.js +3 -2
- package/lib/esm/components/c4-link-button/c4-link-button.d.ts +1 -1
- package/lib/esm/components/c4-link-button/c4-link-button.js +2 -2
- package/lib/esm/components/c4-link-button/c4-link-button.types.d.ts +6 -0
- package/lib/esm/components/c4-page-template/c4-page-template.d.ts +13 -1
- package/lib/esm/components/c4-page-template/c4-page-template.js +3 -3
- package/lib/esm/components/c4-tile-with-title-and-action/c4-tile-with-title-and-action.js +1 -1
- package/lib/esm/components/c4-tile-with-title-and-action/c4-tile-with-title-and-action.types.d.ts +5 -0
- package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.js +2 -1
- package/lib/esm/externalUrls.const.d.ts +1 -1
- package/lib/esm/externalUrls.const.js +1 -1
- package/lib/esm/i18n/c4-console-i18n.js +6 -0
- package/lib/esm/i18n/en/pages/clusterdetails.json +28 -3
- package/lib/esm/i18n/en/pages/job-dashboard.json +2 -0
- package/lib/esm/index.d.ts +13 -3
- package/lib/esm/index.js +7 -3
- package/lib/esm/runtime/build-cluster-sso-callback-url.d.ts +34 -0
- package/lib/esm/runtime/build-cluster-sso-callback-url.js +49 -0
- package/lib/esm/runtime/build-cluster-swagger-url.d.ts +7 -2
- package/lib/esm/runtime/build-cluster-swagger-url.js +20 -5
- package/lib/esm/runtime/index.d.ts +2 -0
- package/lib/esm/runtime/index.js +2 -0
- package/lib/esm/ui/families.d.ts +4 -0
- package/lib/esm/ui/families.js +22 -2
- package/lib/esm/utils/safe-translate.d.ts +27 -0
- package/lib/esm/utils/safe-translate.js +56 -0
- package/lib/esm/utils/section-heading-style.d.ts +13 -0
- package/lib/esm/utils/section-heading-style.js +25 -0
- package/lib/esm/widgets/c4-widget-scope.types.d.ts +20 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.d.ts +16 -1
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +92 -74
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +27 -0
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.d.ts +1 -1
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +81 -13
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +24 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +3 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.d.ts +10 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +8 -13
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +42 -2
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +38 -23
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.d.ts +7 -0
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-encryption-tab.js +26 -5
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.d.ts +16 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +50 -18
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +174 -3
- package/lib/esm/widgets/cluster-details/tabs/cluster-load-texts.d.ts +13 -0
- package/lib/esm/widgets/cluster-details/tabs/cluster-load-texts.js +29 -0
- package/lib/esm/widgets/cluster-health-override.d.ts +16 -0
- package/lib/esm/widgets/cluster-health-override.js +33 -0
- package/lib/esm/widgets/clusters/c4-clusters-page.d.ts +1 -1
- package/lib/esm/widgets/clusters/c4-clusters-page.js +10 -10
- package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +7 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.d.ts +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.js +10 -5
- package/lib/esm/widgets/connector-management/c4-connector-management-executable-details-page.types.d.ts +9 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.d.ts +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.js +10 -5
- package/lib/esm/widgets/connector-management/c4-connector-management-executables-table-page.types.d.ts +9 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.d.ts +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.js +10 -5
- package/lib/esm/widgets/connector-management/c4-connector-management-outbound-details-page.types.d.ts +9 -0
- package/lib/esm/widgets/connector-management/c4-connector-management-page.d.ts +1 -1
- package/lib/esm/widgets/connector-management/c4-connector-management-page.js +10 -5
- package/lib/esm/widgets/connector-management/c4-connector-management-page.types.d.ts +10 -0
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +1 -1
- package/lib/esm/widgets/environment/c4-cluster-api-clients-widget.d.ts +5 -0
- package/lib/esm/widgets/environment/c4-cluster-api-clients-widget.js +66 -0
- package/lib/esm/widgets/environment/c4-cluster-api-clients-widget.types.d.ts +21 -0
- package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.d.ts +5 -0
- package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.js +59 -0
- package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.types.d.ts +22 -0
- package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.types.js +6 -0
- package/lib/esm/widgets/environment/use-cluster-api-clients.d.ts +26 -0
- package/lib/esm/widgets/environment/use-cluster-api-clients.js +48 -0
- package/lib/esm/widgets/environment/use-cluster-swagger-url.d.ts +22 -0
- package/lib/esm/widgets/environment/use-cluster-swagger-url.js +47 -0
- package/lib/esm/widgets/environment/use-cluster-version-flags.d.ts +16 -0
- package/lib/esm/widgets/environment/use-cluster-version-flags.js +40 -0
- package/lib/esm/widgets/job-worker/c4-job-worker-details-page.d.ts +1 -1
- package/lib/esm/widgets/job-worker/c4-job-worker-details-page.js +34 -25
- package/lib/esm/widgets/job-worker/c4-job-worker-overview-page.d.ts +1 -1
- package/lib/esm/widgets/job-worker/c4-job-worker-overview-page.js +26 -21
- package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +12 -0
- package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +6 -0
- package/lib/esm/widgets/job-worker/c4-job-worker.types.d.ts +19 -0
- package/package.json +25 -25
- package/lib/esm/components/c4-advanced-search-filters/ArrayFieldContainer.d.ts +0 -16
- package/lib/esm/components/c4-advanced-search-filters/ArrayFieldContainer.js +0 -40
- package/lib/esm/components/c4-advanced-search-filters/AutosuggestInput.d.ts +0 -16
- package/lib/esm/components/c4-advanced-search-filters/AutosuggestInput.js +0 -142
- package/lib/esm/components/c4-advanced-search-filters/FieldRow.d.ts +0 -14
- package/lib/esm/components/c4-advanced-search-filters/FieldRow.js +0 -136
- package/lib/esm/components/c4-advanced-search-filters/FiltersSection.d.ts +0 -13
- package/lib/esm/components/c4-advanced-search-filters/FiltersSection.js +0 -58
- package/lib/esm/components/c4-advanced-search-filters/OrSection.d.ts +0 -16
- package/lib/esm/components/c4-advanced-search-filters/OrSection.js +0 -118
- package/lib/esm/components/c4-advanced-search-filters/c4-advanced-search-filters.d.ts +0 -3
- package/lib/esm/components/c4-advanced-search-filters/c4-advanced-search-filters.js +0 -408
- package/lib/esm/components/c4-advanced-search-filters/c4-advanced-search-filters.types.d.ts +0 -32
- package/lib/esm/components/c4-advanced-search-filters/state.types.d.ts +0 -14
- package/lib/esm/components/c4-advanced-search-filters/utils.d.ts +0 -5
- package/lib/esm/components/c4-advanced-search-filters/utils.js +0 -58
- /package/lib/esm/{components/c4-advanced-search-filters/c4-advanced-search-filters.types.js → widgets/c4-widget-scope.types.js} +0 -0
- /package/lib/esm/{components/c4-advanced-search-filters/state.types.js → widgets/environment/c4-cluster-api-clients-widget.types.js} +0 -0
|
@@ -24,7 +24,7 @@ function safeTranslate(t, key, fallback) {
|
|
|
24
24
|
function sendNavigate(onNavigate, event) {
|
|
25
25
|
onNavigate?.(event);
|
|
26
26
|
}
|
|
27
|
-
export const C4ConnectorManagementPage = observer(({ orgId, clusterId, activeTab, onNavigate, }) => {
|
|
27
|
+
export const C4ConnectorManagementPage = observer(({ orgId, clusterId, activeTab, onNavigate, scope = 'cluster', }) => {
|
|
28
28
|
const runtime = useC4ConsoleRuntime();
|
|
29
29
|
const t = runtime.i18n?.t;
|
|
30
30
|
const { isLoading, clusterName, connectorsUrl, isProviderReady, Provider, checkClusterVersion, } = useConnectorManagementRuntime({ orgId, clusterId });
|
|
@@ -85,9 +85,11 @@ export const C4ConnectorManagementPage = observer(({ orgId, clusterId, activeTab
|
|
|
85
85
|
onNavigate,
|
|
86
86
|
orgId,
|
|
87
87
|
]);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
// In environment scope the host page owns the breadcrumb, so this widget
|
|
89
|
+
// contributes no trail of its own.
|
|
90
|
+
const breadcrumbs = useMemo(() => scope === 'environment'
|
|
91
|
+
? { elements: [] }
|
|
92
|
+
: {
|
|
91
93
|
elements: [
|
|
92
94
|
{
|
|
93
95
|
key: '1',
|
|
@@ -104,5 +106,8 @@ export const C4ConnectorManagementPage = observer(({ orgId, clusterId, activeTab
|
|
|
104
106
|
}),
|
|
105
107
|
},
|
|
106
108
|
],
|
|
107
|
-
},
|
|
109
|
+
}, [clusterId, clusterName, onNavigate, orgId, scope]);
|
|
110
|
+
return (_jsx(C4PageTemplate, { header: {
|
|
111
|
+
title: headerTitle,
|
|
112
|
+
}, loading: isLoading, breadcrumbs: breadcrumbs, padding: scope === 'environment' ? 'none' : 'default', children: _jsx(ErrorBoundary, { fallback: _jsx(C4ConnectorManagementErrorBoundaryFallback, {}), children: content }) }));
|
|
108
113
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { C4WidgetScope } from '../c4-widget-scope.types.js';
|
|
1
2
|
export type C4ConnectorManagementNavigateEvent = {
|
|
2
3
|
kind: 'clusters';
|
|
3
4
|
orgId: string;
|
|
@@ -26,4 +27,13 @@ export interface C4ConnectorManagementPageProps {
|
|
|
26
27
|
clusterId: string;
|
|
27
28
|
activeTab?: 'inbound' | 'outbound';
|
|
28
29
|
onNavigate?: (event: C4ConnectorManagementNavigateEvent) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Surface this page is rendered on. Defaults to `'cluster'`.
|
|
32
|
+
*
|
|
33
|
+
* `'environment'` **suppresses the page's own `Clusters → <cluster>`
|
|
34
|
+
* breadcrumb and its page padding** — on an environment page the host owns
|
|
35
|
+
* navigation and spacing, so the widget renders only its title and content.
|
|
36
|
+
* This page's copy is scope-neutral, so nothing else changes.
|
|
37
|
+
*/
|
|
38
|
+
scope?: C4WidgetScope;
|
|
29
39
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { C4ClusterApiClientsWidgetProps } from './c4-cluster-api-clients-widget.types.js';
|
|
3
|
+
export declare const C4ClusterApiClientsWidget: (({ orgId, clusterId, scope, urls, onNavigate, }: C4ClusterApiClientsWidgetProps) => JSX.Element) & {
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { useEffect, useMemo } from 'react';
|
|
4
|
+
import { getC4ClusterDetailsUrls } from '../../externalUrls.const.js';
|
|
5
|
+
import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
6
|
+
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
7
|
+
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
8
|
+
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
9
|
+
import { C4ClusterDetailsClientsTab } from '../cluster-details/tabs/c4-cluster-details-clients-tab.js';
|
|
10
|
+
import { useClusterApiClients } from './use-cluster-api-clients.js';
|
|
11
|
+
import { useClusterVersionFlags } from './use-cluster-version-flags.js';
|
|
12
|
+
/**
|
|
13
|
+
* The cluster's API clients as a standalone, self-fetching widget.
|
|
14
|
+
*
|
|
15
|
+
* Same panel Console renders on the cluster-details API tab, but a host passes
|
|
16
|
+
* only `orgId` / `clusterId`: the widget derives the API config, translations,
|
|
17
|
+
* permissions and documentation links from the c4 runtime, and owns the clients
|
|
18
|
+
* fetch. That is what lets Camunda Hub mount it inside an environment page
|
|
19
|
+
* without reimplementing Console's data wiring — the request goes to Console's
|
|
20
|
+
* internal API from the browser with the viewer's own token, so no `/external`
|
|
21
|
+
* contract has to grow for it.
|
|
22
|
+
*
|
|
23
|
+
* Requires a `C4ConsoleRuntimeProvider` and a `C4ConsoleDataProvider` above it.
|
|
24
|
+
*/
|
|
25
|
+
const C4ClusterApiClientsWidgetImpl = ({ orgId, clusterId, scope = 'cluster', urls, onNavigate, }) => {
|
|
26
|
+
const runtime = useC4ConsoleRuntime();
|
|
27
|
+
const data = useC4ConsoleData();
|
|
28
|
+
const t = runtime.i18n?.t;
|
|
29
|
+
const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
|
|
30
|
+
const resolvedUrls = useMemo(
|
|
31
|
+
// `clusters` is the cluster-list href, which only the page shell's
|
|
32
|
+
// breadcrumb uses. This widget renders no breadcrumb, so it is unused here.
|
|
33
|
+
() => getC4ClusterDetailsUrls({ clusters: '', docs: urls?.docs }), [urls?.docs]);
|
|
34
|
+
const authz = useC4ConsoleAuthz({ orgId });
|
|
35
|
+
const orgPermissions = authz.orgPermissions;
|
|
36
|
+
const canReadClients = Boolean(orgPermissions?.cluster.clients.read);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
void data.fetchClusters(orgId);
|
|
39
|
+
}, [data, orgId]);
|
|
40
|
+
const cluster = data
|
|
41
|
+
.getClusters(orgId)
|
|
42
|
+
?.find((candidate) => candidate.uuid === clusterId);
|
|
43
|
+
const { hasIdentityIntegration, useClusterSecretsLabel } = useClusterVersionFlags(cluster);
|
|
44
|
+
const { clients, loading, error, reload } = useClusterApiClients({
|
|
45
|
+
orgId,
|
|
46
|
+
clusterId,
|
|
47
|
+
apiConfig,
|
|
48
|
+
enabled: canReadClients,
|
|
49
|
+
});
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
void reload();
|
|
52
|
+
}, [reload]);
|
|
53
|
+
return (_jsx(C4ClusterDetailsClientsTab, { cluster: cluster, clients: clients,
|
|
54
|
+
// `canReadClients` is false until the token decodes, so no fetch starts.
|
|
55
|
+
// Without `authz.isLoading` the panel shows its "create your first
|
|
56
|
+
// client" empty state for one render pass, then swaps to the real list.
|
|
57
|
+
clientsLoading: loading || authz.isLoading, clientsError: error, hasIdentityIntegration: hasIdentityIntegration, useClusterSecretsLabel: useClusterSecretsLabel, orgId: orgId, clusterId: clusterId, clientsDocsUrl: resolvedUrls.docs.clients, mcpSetupDocsUrl: resolvedUrls.docs.mcpSetup, identityAuthorizationDocsUrl: resolvedUrls.docs.identityAuthorization, springZeebeGettingStartedDocsUrl: resolvedUrls.docs.springZeebeGettingStarted, springZeebeConfigDocsUrl: resolvedUrls.docs.springZeebeConfig, apiConfig: apiConfig, canMutateCluster: Boolean(orgPermissions?.cluster.clients.create), clientsPermissions: {
|
|
58
|
+
canRead: canReadClients,
|
|
59
|
+
canCreate: Boolean(orgPermissions?.cluster.clients.create),
|
|
60
|
+
canUpdate: Boolean(orgPermissions?.cluster.clients.update),
|
|
61
|
+
canDelete: Boolean(orgPermissions?.cluster.clients.delete),
|
|
62
|
+
}, scope: scope, t: t, onNavigate: onNavigate, onReloadClients: reload }));
|
|
63
|
+
};
|
|
64
|
+
// Reads console data during render, so it must be an observer to re-render when
|
|
65
|
+
// that data changes.
|
|
66
|
+
export const C4ClusterApiClientsWidget = observer(C4ClusterApiClientsWidgetImpl);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { C4WidgetScope } from '../c4-widget-scope.types.js';
|
|
2
|
+
import type { C4ClusterDetailsNavigateEvent, C4ClusterDetailsUrls } from '../cluster-details/c4-cluster-details-app.types.js';
|
|
3
|
+
export interface C4ClusterApiClientsWidgetProps {
|
|
4
|
+
orgId: string;
|
|
5
|
+
clusterId: string;
|
|
6
|
+
/**
|
|
7
|
+
* Surface this widget is rendered on. Defaults to `'cluster'`.
|
|
8
|
+
*
|
|
9
|
+
* `'environment'` switches the identity-setup sentence to environment
|
|
10
|
+
* wording. This widget has no breadcrumb or page padding of its own on either
|
|
11
|
+
* surface — it is a panel, not a page — so scope affects copy only here.
|
|
12
|
+
*/
|
|
13
|
+
scope?: C4WidgetScope;
|
|
14
|
+
/**
|
|
15
|
+
* Documentation links. Every entry is optional and falls back to the same
|
|
16
|
+
* default this package uses on Console's cluster-details page, so a host can
|
|
17
|
+
* pass nothing and still get working links.
|
|
18
|
+
*/
|
|
19
|
+
urls?: Pick<C4ClusterDetailsUrls, 'docs'>;
|
|
20
|
+
onNavigate?: (event: C4ClusterDetailsNavigateEvent) => void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { C4ClusterConnectorSecretsWidgetProps } from './c4-cluster-connector-secrets-widget.types.js';
|
|
3
|
+
export declare const C4ClusterConnectorSecretsWidget: (({ orgId, clusterId, scope, urls, onNavigate, }: C4ClusterConnectorSecretsWidgetProps) => JSX.Element) & {
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { getC4ClusterDetailsUrls } from '../../externalUrls.const.js';
|
|
5
|
+
import { useC4ConsoleAuthz } from '../../runtime/c4-console-authz.js';
|
|
6
|
+
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
7
|
+
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
8
|
+
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
9
|
+
import { SECTION_HEADING_STYLE } from '../../utils/section-heading-style.js';
|
|
10
|
+
import { C4ClusterDetailsConnectorSecretsTab } from '../cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js';
|
|
11
|
+
import { useClusterVersionFlags } from './use-cluster-version-flags.js';
|
|
12
|
+
/**
|
|
13
|
+
* The cluster's connector secrets as a standalone, self-fetching widget.
|
|
14
|
+
*
|
|
15
|
+
* Same panel Console renders on the cluster-details secrets tab. The tab already
|
|
16
|
+
* owned its own secrets fetch; this wrapper supplies the rest — API config,
|
|
17
|
+
* translations, permissions, documentation links — from the c4 runtime, so a
|
|
18
|
+
* host passes only `orgId` and `clusterId`.
|
|
19
|
+
*
|
|
20
|
+
* Requires a `C4ConsoleRuntimeProvider` and a `C4ConsoleDataProvider` above it.
|
|
21
|
+
*/
|
|
22
|
+
const C4ClusterConnectorSecretsWidgetImpl = ({ orgId, clusterId, scope = 'cluster', urls, onNavigate, }) => {
|
|
23
|
+
const runtime = useC4ConsoleRuntime();
|
|
24
|
+
const data = useC4ConsoleData();
|
|
25
|
+
const t = runtime.i18n?.t;
|
|
26
|
+
const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
|
|
27
|
+
const resolvedUrls = useMemo(() => getC4ClusterDetailsUrls({ clusters: '', docs: urls?.docs }), [urls?.docs]);
|
|
28
|
+
const authz = useC4ConsoleAuthz({ orgId });
|
|
29
|
+
const orgPermissions = authz.orgPermissions;
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
void data.fetchClusters(orgId);
|
|
32
|
+
}, [data, orgId]);
|
|
33
|
+
const cluster = data
|
|
34
|
+
.getClusters(orgId)
|
|
35
|
+
?.find((candidate) => candidate.uuid === clusterId);
|
|
36
|
+
// 8.10 renames connector secrets to cluster secrets — version-driven product
|
|
37
|
+
// naming, unrelated to `scope`. Shared with Task 5's widget and Console's own
|
|
38
|
+
// cluster-details page via `useClusterVersionFlags`.
|
|
39
|
+
const { useClusterSecretsLabel } = useClusterVersionFlags(cluster);
|
|
40
|
+
// Embedded in the cluster-details page, the tab's feature name is carried by
|
|
41
|
+
// the surrounding TabList label, and the panel only shows its title itself
|
|
42
|
+
// when it has secrets to list (via the data table's own heading) — its empty
|
|
43
|
+
// state shows a generic "No secrets" heading instead. Here there is no
|
|
44
|
+
// TabList — this widget is the whole surface — so when the panel is empty it
|
|
45
|
+
// needs its own heading with the feature name, or nothing shows it at all.
|
|
46
|
+
// When the panel has secrets, the table's own title already covers it, so
|
|
47
|
+
// this widget must not add a second one. `title` is read from the tab's own
|
|
48
|
+
// `onPanelState` report rather than re-derived, so there is exactly one
|
|
49
|
+
// place resolving this string.
|
|
50
|
+
const [panelState, setPanelState] = useState({ isEmpty: false, title: '' });
|
|
51
|
+
return (_jsxs(_Fragment, { children: [panelState.isEmpty && (_jsx("h3", { style: SECTION_HEADING_STYLE, children: panelState.title })), _jsx(C4ClusterDetailsConnectorSecretsTab, { permissionsLoading: authz.isLoading, orgId: orgId, clusterId: clusterId, apiConfig: apiConfig, canMutateCluster: Boolean(orgPermissions?.cluster.connectorSecrets.update), useClusterSecretsLabel: useClusterSecretsLabel, connectorSecretsPermissions: {
|
|
52
|
+
canCreate: Boolean(orgPermissions?.cluster.connectorSecrets.create),
|
|
53
|
+
canRead: Boolean(orgPermissions?.cluster.connectorSecrets.read),
|
|
54
|
+
canUpdate: Boolean(orgPermissions?.cluster.connectorSecrets.update),
|
|
55
|
+
canDelete: Boolean(orgPermissions?.cluster.connectorSecrets.delete),
|
|
56
|
+
}, docsUrl: resolvedUrls.docs.connectorSecrets, scope: scope, t: t, onNavigate: onNavigate, onPanelState: setPanelState })] }));
|
|
57
|
+
};
|
|
58
|
+
// Reads console data during render, so it must be an observer.
|
|
59
|
+
export const C4ClusterConnectorSecretsWidget = observer(C4ClusterConnectorSecretsWidgetImpl);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { C4WidgetScope } from '../c4-widget-scope.types.js';
|
|
2
|
+
import type { C4ClusterDetailsUrls } from '../cluster-details/c4-cluster-details-app.types.js';
|
|
3
|
+
export interface C4ClusterConnectorSecretsWidgetProps {
|
|
4
|
+
orgId: string;
|
|
5
|
+
clusterId: string;
|
|
6
|
+
/**
|
|
7
|
+
* Surface this widget is rendered on. Defaults to `'cluster'`.
|
|
8
|
+
*
|
|
9
|
+
* `'environment'` switches the one sentence that names where a secret lives.
|
|
10
|
+
* The feature name is version-driven, not scope-driven, and does not change.
|
|
11
|
+
*/
|
|
12
|
+
scope?: C4WidgetScope;
|
|
13
|
+
/**
|
|
14
|
+
* Documentation links. Optional — falls back to the same default this package
|
|
15
|
+
* uses on Console's cluster-details page.
|
|
16
|
+
*/
|
|
17
|
+
urls?: Pick<C4ClusterDetailsUrls, 'docs'>;
|
|
18
|
+
onNavigate?: (event: {
|
|
19
|
+
kind: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ConsoleClusterClientDto, RequestBaseParamsConfig } from '@camunda/ccma-api';
|
|
2
|
+
export interface ClusterApiClientsState {
|
|
3
|
+
clients: ConsoleClusterClientDto[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
/** True when the last load failed. The panel renders its own retry affordance. */
|
|
6
|
+
error: boolean;
|
|
7
|
+
reload: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The cluster's API clients, with the load/error/reload state the clients panel
|
|
11
|
+
* needs.
|
|
12
|
+
*
|
|
13
|
+
* Extracted from `C4ClusterDetailsApp` so the standalone
|
|
14
|
+
* `C4ClusterApiClientsWidget` and the cluster-details page share one
|
|
15
|
+
* implementation — otherwise a host embedding the widget would silently drift
|
|
16
|
+
* from Console's own tab on every change here.
|
|
17
|
+
*
|
|
18
|
+
* `enabled: false` (the viewer may not read clients) resolves to an empty list
|
|
19
|
+
* without issuing a request, rather than surfacing a 403 as an error state.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useClusterApiClients(params: {
|
|
22
|
+
orgId: string;
|
|
23
|
+
clusterId: string;
|
|
24
|
+
apiConfig: RequestBaseParamsConfig;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
}): ClusterApiClientsState;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
import { ConsoleClusterClientsService } from '@camunda/ccma-api';
|
|
7
|
+
import { useCallback, useState } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* The cluster's API clients, with the load/error/reload state the clients panel
|
|
10
|
+
* needs.
|
|
11
|
+
*
|
|
12
|
+
* Extracted from `C4ClusterDetailsApp` so the standalone
|
|
13
|
+
* `C4ClusterApiClientsWidget` and the cluster-details page share one
|
|
14
|
+
* implementation — otherwise a host embedding the widget would silently drift
|
|
15
|
+
* from Console's own tab on every change here.
|
|
16
|
+
*
|
|
17
|
+
* `enabled: false` (the viewer may not read clients) resolves to an empty list
|
|
18
|
+
* without issuing a request, rather than surfacing a 403 as an error state.
|
|
19
|
+
*/
|
|
20
|
+
export function useClusterApiClients(params) {
|
|
21
|
+
const { orgId, clusterId, apiConfig, enabled } = params;
|
|
22
|
+
const [clients, setClients] = useState([]);
|
|
23
|
+
const [loading, setLoading] = useState(false);
|
|
24
|
+
const [error, setError] = useState(false);
|
|
25
|
+
const reload = useCallback(async () => {
|
|
26
|
+
if (!enabled) {
|
|
27
|
+
setClients([]);
|
|
28
|
+
setError(false);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
setLoading(true);
|
|
32
|
+
setError(false);
|
|
33
|
+
try {
|
|
34
|
+
const loaded = await ConsoleClusterClientsService.getAll({
|
|
35
|
+
config: apiConfig,
|
|
36
|
+
params: { orgId, clusterId },
|
|
37
|
+
});
|
|
38
|
+
setClients(loaded);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
setError(true);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setLoading(false);
|
|
45
|
+
}
|
|
46
|
+
}, [apiConfig, clusterId, enabled, orgId]);
|
|
47
|
+
return { clients, loading, error, reload };
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cluster's Swagger UI URL, or `undefined` when there isn't one.
|
|
3
|
+
*
|
|
4
|
+
* A host must handle all five `undefined` cases the same way, and hide the
|
|
5
|
+
* affordance:
|
|
6
|
+
* - The cluster is older than `SWAGGER_MIN_VERSION`.
|
|
7
|
+
* - The cluster has swagger disabled.
|
|
8
|
+
* - The cluster has no `operateUrl` yet, because it is still in creation.
|
|
9
|
+
* - The cluster is not loaded into the data context.
|
|
10
|
+
* - The `operateUrl` of the cluster does not parse as a URL.
|
|
11
|
+
*
|
|
12
|
+
* This reads the cluster from the c4 data context — which fetches Console's
|
|
13
|
+
* internal API from the browser with the viewer's own token — so a host can
|
|
14
|
+
* offer "Open Swagger UI" in an environment view without the URL having to
|
|
15
|
+
* travel through its own backend.
|
|
16
|
+
*
|
|
17
|
+
* Requires a `C4ConsoleRuntimeProvider` and a `C4ConsoleDataProvider` above it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useClusterSwaggerUrl(params: {
|
|
20
|
+
orgId: string;
|
|
21
|
+
clusterId: string;
|
|
22
|
+
}): string | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
import { useEffect, useMemo } from 'react';
|
|
7
|
+
import { buildClusterSwaggerUrl } from '../../runtime/build-cluster-swagger-url.js';
|
|
8
|
+
import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
|
|
9
|
+
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
10
|
+
/**
|
|
11
|
+
* The cluster's Swagger UI URL, or `undefined` when there isn't one.
|
|
12
|
+
*
|
|
13
|
+
* A host must handle all five `undefined` cases the same way, and hide the
|
|
14
|
+
* affordance:
|
|
15
|
+
* - The cluster is older than `SWAGGER_MIN_VERSION`.
|
|
16
|
+
* - The cluster has swagger disabled.
|
|
17
|
+
* - The cluster has no `operateUrl` yet, because it is still in creation.
|
|
18
|
+
* - The cluster is not loaded into the data context.
|
|
19
|
+
* - The `operateUrl` of the cluster does not parse as a URL.
|
|
20
|
+
*
|
|
21
|
+
* This reads the cluster from the c4 data context — which fetches Console's
|
|
22
|
+
* internal API from the browser with the viewer's own token — so a host can
|
|
23
|
+
* offer "Open Swagger UI" in an environment view without the URL having to
|
|
24
|
+
* travel through its own backend.
|
|
25
|
+
*
|
|
26
|
+
* Requires a `C4ConsoleRuntimeProvider` and a `C4ConsoleDataProvider` above it.
|
|
27
|
+
*/
|
|
28
|
+
export function useClusterSwaggerUrl(params) {
|
|
29
|
+
const { orgId, clusterId } = params;
|
|
30
|
+
const runtime = useC4ConsoleRuntime();
|
|
31
|
+
const data = useC4ConsoleData();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
void data.fetchClusters(orgId);
|
|
34
|
+
}, [data, orgId]);
|
|
35
|
+
const cluster = data
|
|
36
|
+
.getClusters(orgId)
|
|
37
|
+
?.find((candidate) => candidate.uuid === clusterId);
|
|
38
|
+
return useMemo(() => {
|
|
39
|
+
if (!cluster)
|
|
40
|
+
return undefined;
|
|
41
|
+
return buildClusterSwaggerUrl({
|
|
42
|
+
cluster,
|
|
43
|
+
clusterId,
|
|
44
|
+
stage: runtime.stage,
|
|
45
|
+
});
|
|
46
|
+
}, [cluster, clusterId, runtime.stage]);
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConsoleClusterDto } from '@camunda/ccma-shared-types';
|
|
2
|
+
export interface ClusterVersionFlags {
|
|
3
|
+
/** Identity-backed authorizations, available from Zeebe 8.8.0-alpha5. */
|
|
4
|
+
hasIdentityIntegration: boolean;
|
|
5
|
+
/** 8.10+ renames "Connector secrets" to "Cluster secrets" in the UI. */
|
|
6
|
+
useClusterSecretsLabel: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Version-gated capability flags derived from a cluster's Zeebe version.
|
|
10
|
+
*
|
|
11
|
+
* Extracted from `C4ClusterDetailsApp` so the app and every standalone widget
|
|
12
|
+
* that needs one of these flags (`C4ClusterApiClientsWidget`,
|
|
13
|
+
* `C4ClusterConnectorSecretsWidget`) share one implementation — otherwise the
|
|
14
|
+
* same two version gates would be copied three times and could drift.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useClusterVersionFlags(cluster: ConsoleClusterDto | undefined): ClusterVersionFlags;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import { CLUSTER_SECRETS_LABEL_MIN_VERSION, checkVersion, IDENTITY_MANAGEMENT_MIN_VERSION, VersionCheckOperator, } from '@camunda/ccma-shared-types';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* Version-gated capability flags derived from a cluster's Zeebe version.
|
|
10
|
+
*
|
|
11
|
+
* Extracted from `C4ClusterDetailsApp` so the app and every standalone widget
|
|
12
|
+
* that needs one of these flags (`C4ClusterApiClientsWidget`,
|
|
13
|
+
* `C4ClusterConnectorSecretsWidget`) share one implementation — otherwise the
|
|
14
|
+
* same two version gates would be copied three times and could drift.
|
|
15
|
+
*/
|
|
16
|
+
export function useClusterVersionFlags(cluster) {
|
|
17
|
+
const zeebeVersion = cluster?.generation?.versions?.zeebe;
|
|
18
|
+
const hasIdentityIntegration = useMemo(() => {
|
|
19
|
+
if (!zeebeVersion)
|
|
20
|
+
return false;
|
|
21
|
+
return checkVersion({
|
|
22
|
+
possiblyVersionOrDockerPath: zeebeVersion,
|
|
23
|
+
trueForSnapshot: true,
|
|
24
|
+
operator: VersionCheckOperator.GreaterThanOrEqual,
|
|
25
|
+
versionToCompareTo: IDENTITY_MANAGEMENT_MIN_VERSION,
|
|
26
|
+
trueOnInvalidVersion: false,
|
|
27
|
+
});
|
|
28
|
+
}, [zeebeVersion]);
|
|
29
|
+
const useClusterSecretsLabel = useMemo(() => {
|
|
30
|
+
if (!zeebeVersion)
|
|
31
|
+
return false;
|
|
32
|
+
return checkVersion({
|
|
33
|
+
possiblyVersionOrDockerPath: zeebeVersion,
|
|
34
|
+
trueForSnapshot: 'compare',
|
|
35
|
+
operator: VersionCheckOperator.GreaterThanOrEqual,
|
|
36
|
+
versionToCompareTo: CLUSTER_SECRETS_LABEL_MIN_VERSION,
|
|
37
|
+
});
|
|
38
|
+
}, [zeebeVersion]);
|
|
39
|
+
return { hasIdentityIntegration, useClusterSecretsLabel };
|
|
40
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
2
|
import type { C4JobWorkerDetailsPageProps } from './c4-job-worker.types.js';
|
|
3
|
-
export declare const C4JobWorkerDetailsPage: (({ orgId, clusterId, jobType: jobTypeProp, onNavigate, }: C4JobWorkerDetailsPageProps) => JSX.Element) & {
|
|
3
|
+
export declare const C4JobWorkerDetailsPage: (({ orgId, clusterId, jobType: jobTypeProp, onNavigate, scope, }: C4JobWorkerDetailsPageProps) => JSX.Element) & {
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
@@ -10,8 +10,8 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
10
10
|
import { C4JobDashboardDetailsPage } from '../../components/c4-job-dashboard-details-page/c4-job-dashboard-details-page.js';
|
|
11
11
|
import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
|
|
12
12
|
import { toApiConfig } from '../../runtime/to-api-config.js';
|
|
13
|
-
import { getRegion, latestUpdateTime, makeTr, safeDecodeURIComponent, safeT, toJobsError, } from './c4-job-worker.helpers.js';
|
|
14
|
-
function buildDetailsTranslations(tr) {
|
|
13
|
+
import { getRegion, latestUpdateTime, makeScopedTr, makeTr, safeDecodeURIComponent, safeT, toJobsError, } from './c4-job-worker.helpers.js';
|
|
14
|
+
function buildDetailsTranslations(tr, trScoped) {
|
|
15
15
|
return {
|
|
16
16
|
title: tr('details.title', 'Job type details'),
|
|
17
17
|
lastUpdated: tr('shared.lastUpdated', 'Last updated'),
|
|
@@ -75,7 +75,7 @@ function buildDetailsTranslations(tr) {
|
|
|
75
75
|
},
|
|
76
76
|
empty: {
|
|
77
77
|
title: tr('shared.errorHandler.empty.title', 'No data available.'),
|
|
78
|
-
description:
|
|
78
|
+
description: trScoped('shared.errorHandler.empty.description', 'No data was found for this cluster.', 'No data was found for this environment.'),
|
|
79
79
|
learnMoreLabel: tr('shared.errorHandler.empty.learnMoreLabel', 'Learn more about jobs and job workers'),
|
|
80
80
|
},
|
|
81
81
|
generalError: {
|
|
@@ -101,11 +101,12 @@ const INITIAL_JOB_DATA = {
|
|
|
101
101
|
const INITIAL_WORKER_DATA = { items: [], isLoading: false };
|
|
102
102
|
const INITIAL_TIME_SERIES = { items: [], isLoading: false };
|
|
103
103
|
const INITIAL_ERROR_DATA = { items: [], isLoading: false };
|
|
104
|
-
export const C4JobWorkerDetailsPage = observer(({ orgId, clusterId, jobType: jobTypeProp, onNavigate, }) => {
|
|
104
|
+
export const C4JobWorkerDetailsPage = observer(({ orgId, clusterId, jobType: jobTypeProp, onNavigate, scope = 'cluster', }) => {
|
|
105
105
|
const runtime = useC4ConsoleRuntime();
|
|
106
106
|
const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
|
|
107
107
|
const t = runtime.i18n?.t;
|
|
108
108
|
const tr = useMemo(() => makeTr(t), [t]);
|
|
109
|
+
const trScoped = useMemo(() => makeScopedTr(tr, scope), [tr, scope]);
|
|
109
110
|
const [cluster, setCluster] = useState();
|
|
110
111
|
const [clusterLoading, setClusterLoading] = useState(false);
|
|
111
112
|
const [config, setConfig] = useState();
|
|
@@ -284,26 +285,34 @@ export const C4JobWorkerDetailsPage = observer(({ orgId, clusterId, jobType: job
|
|
|
284
285
|
useEffect(() => {
|
|
285
286
|
void loadData();
|
|
286
287
|
}, [loadData]);
|
|
287
|
-
const translations = useMemo(() => buildDetailsTranslations(tr), [tr]);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
288
|
+
const translations = useMemo(() => buildDetailsTranslations(tr, trScoped), [tr, trScoped]);
|
|
289
|
+
// In environment scope the host page owns the breadcrumb, so this widget
|
|
290
|
+
// contributes no trail of its own.
|
|
291
|
+
const breadcrumb = useMemo(() => scope === 'environment'
|
|
292
|
+
? { elements: [] }
|
|
293
|
+
: {
|
|
294
|
+
elements: [
|
|
295
|
+
{
|
|
296
|
+
key: '1',
|
|
297
|
+
label: safeT(t, 'c4console:clusters.list.title', 'Clusters'),
|
|
298
|
+
onClick: () => onNavigate?.({ kind: 'clusters', orgId }),
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
key: '2',
|
|
302
|
+
label: cluster?.name ?? clusterId,
|
|
303
|
+
onClick: () => onNavigate?.({ kind: 'clusterDetails', orgId, clusterId }),
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
key: '3',
|
|
307
|
+
label: safeT(t, 'c4console:clusters.details.jobDashboard', 'Job dashboard'),
|
|
308
|
+
onClick: () => onNavigate?.({
|
|
309
|
+
kind: 'jobWorkerOverview',
|
|
310
|
+
orgId,
|
|
311
|
+
clusterId,
|
|
312
|
+
}),
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
}, [cluster?.name, clusterId, onNavigate, orgId, scope, t]);
|
|
307
316
|
const operateBaseUrl = cluster?.status?.operateUrl ?? null;
|
|
308
|
-
return (_jsx(C4JobDashboardDetailsPage, { jobType: safeDecodeURIComponent(jobTypeProp), config: config, isLoadingConfig: configLoading || clusterLoading, lastUpdatedAt: lastUpdatedAt, breadcrumb: breadcrumb, jobData: jobData, workerData: workerData, timeSeries: timeSeries, errorData: { ...errorData, operateBaseUrl }, onTimeRangeChange: setRange, translations: translations }));
|
|
317
|
+
return (_jsx(C4JobDashboardDetailsPage, { jobType: safeDecodeURIComponent(jobTypeProp), config: config, isLoadingConfig: configLoading || clusterLoading, lastUpdatedAt: lastUpdatedAt, breadcrumb: breadcrumb, jobData: jobData, workerData: workerData, timeSeries: timeSeries, errorData: { ...errorData, operateBaseUrl }, onTimeRangeChange: setRange, translations: translations, padding: scope === 'environment' ? 'none' : 'default' }));
|
|
309
318
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSX } from 'react';
|
|
2
2
|
import type { C4JobWorkerOverviewPageProps } from './c4-job-worker.types.js';
|
|
3
|
-
export declare const C4JobWorkerOverviewPage: (({ orgId, clusterId, onNavigate, }: C4JobWorkerOverviewPageProps) => JSX.Element) & {
|
|
3
|
+
export declare const C4JobWorkerOverviewPage: (({ orgId, clusterId, onNavigate, scope, }: C4JobWorkerOverviewPageProps) => JSX.Element) & {
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|