@camunda/ccma-saas-frontend 0.15.1 → 0.16.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.js +4 -10
- package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +1 -4
- package/lib/esm/components/c4-cluster-overview/applications.js +91 -16
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.d.ts +31 -1
- package/lib/esm/components/c4-cluster-overview/c4-cluster-overview.js +28 -0
- package/lib/esm/components/c4-cluster-overview/cluster-details.js +2 -8
- package/lib/esm/components/c4-cluster-overview/cluster-load.js +3 -2
- package/lib/esm/components/c4-cluster-overview/ds-status-icon-text.d.ts +33 -0
- package/lib/esm/components/c4-cluster-overview/ds-status-icon-text.js +34 -0
- package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.js +6 -5
- package/lib/esm/components/c4-sm-cluster-details/details.js +2 -8
- package/lib/esm/components/c4-usage-history/elements/usage-history-charts.d.ts +3 -3
- package/lib/esm/components/c4-usage-metrics-per-cluster/c4-usage-metrics-per-cluster.js +2 -8
- package/lib/esm/index.d.ts +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/runtime/c4-console-events-context.d.ts +5 -1
- package/lib/esm/runtime/c4-console-events-context.js +16 -2
- package/lib/esm/runtime/c4-console-runtime-context.d.ts +7 -6
- package/lib/esm/runtime/c4-console-runtime-context.js +29 -12
- package/lib/esm/runtime/c4-console-runtime.types.d.ts +7 -7
- package/lib/esm/runtime/c4-user-notifications-context.js +6 -2
- package/lib/esm/runtime/c4-user-notifications-context.types.d.ts +5 -1
- package/lib/esm/runtime/use-hub-api-naming.d.ts +8 -11
- package/lib/esm/runtime/use-hub-api-naming.js +9 -12
- package/lib/esm/runtime/use-is-qa-user.d.ts +23 -0
- package/lib/esm/runtime/use-is-qa-user.js +64 -0
- package/lib/esm/ui/c4-cluster-tag.d.ts +11 -0
- package/lib/esm/ui/c4-cluster-tag.js +39 -0
- package/lib/esm/ui/index.js +8 -7
- package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +0 -3
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +3 -4
- package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +1 -1
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +2 -14
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +3 -3
- package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +0 -5
- package/lib/esm/widgets/clusters/c4-clusters-page.js +0 -4
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +1 -1
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +6 -16
- package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +0 -3
- package/lib/esm/widgets/dashboard/c4-dashboard-app.js +5 -6
- package/lib/esm/widgets/dashboard/c4-dashboard-app.types.d.ts +2 -3
- package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
- package/lib/esm/widgets/management/c4-management-app.js +19 -33
- package/lib/esm/widgets/management/c4-management-app.types.d.ts +4 -9
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.d.ts +0 -1
- package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -2
- package/lib/esm/widgets/management/tabs/c4-management-usage-tab.d.ts +2 -2
- package/package.json +19 -19
- package/lib/esm/runtime/cluster-duplication.d.ts +0 -10
- package/lib/esm/runtime/cluster-duplication.js +0 -15
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
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 { C3ClusterTag, } from '@camunda/camunda-composite-components';
|
|
8
2
|
import { Add, WarningAltFilled } from '@carbon/react/icons/index.esm.js';
|
|
9
3
|
import { useCallback, useEffect, useRef, } from 'react';
|
|
10
4
|
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
11
|
-
import { Button, Link } from '../../ui/index.js';
|
|
5
|
+
import { Button, ClusterTag, Link } from '../../ui/index.js';
|
|
12
6
|
import { ClusterStatusElement, normalizeClusterStatus, } from '../c4-cluster-overview/applications.js';
|
|
13
|
-
import { C4IconAndTextElement, getClusterLoadConfig, } from '../c4-cluster-overview/c4-cluster-overview.js';
|
|
7
|
+
import { C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from '../c4-cluster-overview/c4-cluster-overview.js';
|
|
14
8
|
import { C4DataTable } from '../c4-data-table/c4-data-table.js';
|
|
15
9
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
16
10
|
import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
@@ -288,7 +282,7 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
288
282
|
options: {
|
|
289
283
|
wrapperOptions: {
|
|
290
284
|
wrapper: (row) => {
|
|
291
|
-
return row.tags?.length > 0 ? (_jsx(
|
|
285
|
+
return row.tags?.length > 0 ? (_jsx(ClusterTag, { stage: row.tags[0] })) : (permissions.canUpdateTag && (_jsx(C4LinkButton, { label: translations.tags.addLabel, onClick: () => onAssignTag(row.id), disabled: !permissions.canUpdateTag, style: { alignSelf: 'center' }, icon: _jsx(Add, {}) })));
|
|
292
286
|
},
|
|
293
287
|
},
|
|
294
288
|
},
|
|
@@ -312,7 +306,7 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
|
|
|
312
306
|
}
|
|
313
307
|
const currentClusterLoadConfig = getClusterLoadConfig(row.currentClusterLoad);
|
|
314
308
|
return (_jsx(_Fragment, { children: row.currentClusterLoad === undefined ||
|
|
315
|
-
isClusterPaused(row.id) ? (_jsx("span", { children: "-" })) : (_jsx(C4IconAndTextElement, { text: `${row.currentClusterLoad.toFixed(2)}%`, color: currentClusterLoadConfig.color, icon: currentClusterLoadConfig.icon, tooltip: {
|
|
309
|
+
isClusterPaused(row.id) ? (_jsx("span", { children: "-" })) : (_jsx(C4IconAndTextElement, { text: `${row.currentClusterLoad.toFixed(2)}%`, color: currentClusterLoadConfig.color, icon: currentClusterLoadConfig.icon, dsIcon: getDsClusterLoadPresentation(row.currentClusterLoad), tooltip: {
|
|
316
310
|
label: translations.tooltips.clusterLoad,
|
|
317
311
|
align: row.originalIndex > 1 ? 'top' : 'bottom',
|
|
318
312
|
} })) }));
|
|
@@ -23,10 +23,7 @@ export interface ClusterListPermissions {
|
|
|
23
23
|
canSeeClusterLoad: boolean;
|
|
24
24
|
canWakeCluster: boolean;
|
|
25
25
|
canFailoverCluster?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Gated by the `console.clusterDuplication` flag as well as by the create
|
|
28
|
-
* permission: a duplicate makes a cluster.
|
|
29
|
-
*/
|
|
26
|
+
/** Gated by the create permission: a duplicate makes a cluster. */
|
|
30
27
|
canDuplicateCluster?: boolean;
|
|
31
28
|
createClusterButtonDisabled: boolean;
|
|
32
29
|
}
|
|
@@ -6,10 +6,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
import { preview__IconIndicator as IconIndicator, Layer } from '@carbon/react';
|
|
8
8
|
import { ArrowRight, CheckmarkFilled, Information, PauseOutlineFilled, PendingFilled, WarningFilled, } from '@carbon/react/icons/index.esm.js';
|
|
9
|
+
import { CircleAlert, CircleCheck, CirclePause, CircleX, Info, RefreshCw, Wrench, } from 'lucide-react';
|
|
9
10
|
import { useEffect, useState } from 'react';
|
|
11
|
+
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
10
12
|
import { Link, Loading, Stack, Tile, Tooltip } from '../../ui/index.js';
|
|
11
13
|
import { mediaSizeByWidth } from '../c4-billing-page/elements/current-usage-metrics.js';
|
|
12
14
|
import { C4TileWithTitleAndAction } from '../c4-tile-with-title-and-action/c4-tile-with-title-and-action.js';
|
|
15
|
+
import { DS_STATUS_ICON_COLORS, DsStatusIconText, SpinningLoader, } from './ds-status-icon-text.js';
|
|
13
16
|
const MAINTENANCE_STATUS_TEXT = 'Maintenance';
|
|
14
17
|
const MAINTENANCE_INDICATOR_KIND = 'undefined';
|
|
15
18
|
export var StatusColor;
|
|
@@ -48,6 +51,58 @@ export const normalizeClusterStatus = (status) => {
|
|
|
48
51
|
return undefined;
|
|
49
52
|
}
|
|
50
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Icon, color and label of each status in ds mode. They follow the
|
|
56
|
+
* environment status in Hub. 'restoring', 'waitingForInput' and 'maintenance'
|
|
57
|
+
* have no Hub counterpart and get their own icons.
|
|
58
|
+
*/
|
|
59
|
+
const DS_CLUSTER_STATUS_PRESENTATION = {
|
|
60
|
+
healthy: {
|
|
61
|
+
label: 'Healthy',
|
|
62
|
+
icon: CircleCheck,
|
|
63
|
+
color: DS_STATUS_ICON_COLORS.success,
|
|
64
|
+
},
|
|
65
|
+
unhealthy: {
|
|
66
|
+
label: 'Unhealthy',
|
|
67
|
+
icon: CircleX,
|
|
68
|
+
color: DS_STATUS_ICON_COLORS.danger,
|
|
69
|
+
},
|
|
70
|
+
creating: {
|
|
71
|
+
label: 'Creating…',
|
|
72
|
+
icon: SpinningLoader,
|
|
73
|
+
color: DS_STATUS_ICON_COLORS.info,
|
|
74
|
+
},
|
|
75
|
+
updating: {
|
|
76
|
+
label: 'Updating…',
|
|
77
|
+
icon: SpinningLoader,
|
|
78
|
+
color: DS_STATUS_ICON_COLORS.info,
|
|
79
|
+
},
|
|
80
|
+
restoring: {
|
|
81
|
+
label: 'Restoring…',
|
|
82
|
+
icon: SpinningLoader,
|
|
83
|
+
color: DS_STATUS_ICON_COLORS.info,
|
|
84
|
+
},
|
|
85
|
+
resuming: {
|
|
86
|
+
label: 'Resuming',
|
|
87
|
+
icon: RefreshCw,
|
|
88
|
+
color: DS_STATUS_ICON_COLORS.info,
|
|
89
|
+
},
|
|
90
|
+
suspended: {
|
|
91
|
+
label: 'Paused',
|
|
92
|
+
icon: CirclePause,
|
|
93
|
+
color: DS_STATUS_ICON_COLORS.neutral,
|
|
94
|
+
},
|
|
95
|
+
waitingForInput: {
|
|
96
|
+
label: 'Waiting',
|
|
97
|
+
icon: CircleAlert,
|
|
98
|
+
color: DS_STATUS_ICON_COLORS.warning,
|
|
99
|
+
},
|
|
100
|
+
maintenance: {
|
|
101
|
+
label: MAINTENANCE_STATUS_TEXT,
|
|
102
|
+
icon: Wrench,
|
|
103
|
+
color: DS_STATUS_ICON_COLORS.neutral,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
51
106
|
export const ClusterStatusElement = (props) => {
|
|
52
107
|
const isMaintenanceStatus = props.status === 'maintenance';
|
|
53
108
|
// Which states get the info affordance next to the status text. A healthy
|
|
@@ -57,6 +112,39 @@ export const ClusterStatusElement = (props) => {
|
|
|
57
112
|
const supportsInfoTooltip = props.status === 'waitingForInput' ||
|
|
58
113
|
props.status === 'updating' ||
|
|
59
114
|
props.status === 'unhealthy';
|
|
115
|
+
const designSystem = useC4DesignSystem();
|
|
116
|
+
const renderInfoTooltip = (infoIcon, iconColor) => (_jsx(Tooltip, { align: 'bottom', description: _jsx("span", { style: {
|
|
117
|
+
display: 'block',
|
|
118
|
+
whiteSpace: 'normal',
|
|
119
|
+
maxWidth: '16rem',
|
|
120
|
+
}, children: props.infoTooltip }), children: _jsx("button", { type: 'button', "aria-label": props.infoTooltip, onClick: () => props.onInfoClick?.(), style: {
|
|
121
|
+
display: 'inline-flex',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
minBlockSize: '1.5rem',
|
|
125
|
+
minInlineSize: '1.5rem',
|
|
126
|
+
padding: 0,
|
|
127
|
+
border: 0,
|
|
128
|
+
background: 'transparent',
|
|
129
|
+
color: iconColor,
|
|
130
|
+
cursor: 'pointer',
|
|
131
|
+
}, children: infoIcon }) }));
|
|
132
|
+
if (designSystem === 'ds') {
|
|
133
|
+
// Some callers pass a raw API value that is only lowercased, for example
|
|
134
|
+
// 'waitingforinput' or 'unknown'. Normalize it first, and show an empty
|
|
135
|
+
// cell for a value we do not know, like the carbon path does.
|
|
136
|
+
const dsStatus = normalizeClusterStatus(props.status);
|
|
137
|
+
if (!dsStatus) {
|
|
138
|
+
return _jsx("div", { style: props.style });
|
|
139
|
+
}
|
|
140
|
+
const presentation = DS_CLUSTER_STATUS_PRESENTATION[dsStatus];
|
|
141
|
+
const dsSupportsInfoTooltip = dsStatus === 'waitingForInput' ||
|
|
142
|
+
dsStatus === 'updating' ||
|
|
143
|
+
dsStatus === 'unhealthy';
|
|
144
|
+
return (_jsxs(DsStatusIconText, { status: presentation, style: props.style, children: [_jsx("span", { children: presentation.label }), dsSupportsInfoTooltip &&
|
|
145
|
+
props.infoTooltip &&
|
|
146
|
+
renderInfoTooltip(_jsx(Info, { className: 'size-4', "aria-hidden": true }), DS_STATUS_ICON_COLORS.neutral)] }));
|
|
147
|
+
}
|
|
60
148
|
let icon = null;
|
|
61
149
|
let text = '';
|
|
62
150
|
let color;
|
|
@@ -120,22 +208,9 @@ export const ClusterStatusElement = (props) => {
|
|
|
120
208
|
display: 'inline-flex',
|
|
121
209
|
alignItems: 'center',
|
|
122
210
|
gap: '0.125rem',
|
|
123
|
-
}, children: [_jsx("span", { children: text }), supportsInfoTooltip &&
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
maxWidth: '16rem',
|
|
127
|
-
}, children: props.infoTooltip }), children: _jsx("button", { type: 'button', "aria-label": props.infoTooltip, onClick: () => props.onInfoClick?.(), style: {
|
|
128
|
-
display: 'inline-flex',
|
|
129
|
-
alignItems: 'center',
|
|
130
|
-
justifyContent: 'center',
|
|
131
|
-
minBlockSize: '1.5rem',
|
|
132
|
-
minInlineSize: '1.5rem',
|
|
133
|
-
padding: 0,
|
|
134
|
-
border: 0,
|
|
135
|
-
background: 'transparent',
|
|
136
|
-
color: 'var(--cds-icon-primary)',
|
|
137
|
-
cursor: 'pointer',
|
|
138
|
-
}, children: _jsx(Information, {}) }) }))] }))] }) }));
|
|
211
|
+
}, children: [_jsx("span", { children: text }), supportsInfoTooltip &&
|
|
212
|
+
props.infoTooltip &&
|
|
213
|
+
renderInfoTooltip(_jsx(Information, {}), 'var(--cds-icon-primary)')] }))] }) }));
|
|
139
214
|
return component;
|
|
140
215
|
};
|
|
141
216
|
export const ApplicationTile = (props) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, JSX } from 'react';
|
|
2
2
|
import type { C4ClusterOverviewProps } from './c4-cluster-overview.types.js';
|
|
3
|
+
import { type DsStatusIcon } from './ds-status-icon-text.js';
|
|
3
4
|
export declare const C4ClusterOverview: ({ applications, details, clusterLoad, rbaNotification, jobDashboard, overviewSection, }: C4ClusterOverviewProps) => JSX.Element;
|
|
4
5
|
export declare const C4IconAndTextElement: (props: {
|
|
5
6
|
icon: any;
|
|
@@ -10,9 +11,38 @@ export declare const C4IconAndTextElement: (props: {
|
|
|
10
11
|
label: string;
|
|
11
12
|
align?: "top" | "bottom" | "left" | "right";
|
|
12
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* ds-mode only. The lucide icon and color to show in ds mode, for example
|
|
16
|
+
* from `getDsClusterLoadPresentation`. Without it, ds mode shows `icon`
|
|
17
|
+
* and `color` in the carbon layout.
|
|
18
|
+
*/
|
|
19
|
+
dsIcon?: DsStatusIcon;
|
|
13
20
|
}) => JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* The lucide icon and color for a cluster load in ds mode. It uses the same
|
|
23
|
+
* ranges as `getClusterLoadConfig`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getDsClusterLoadPresentation(currentValue: number): DsStatusIcon;
|
|
14
26
|
export declare function getClusterLoadConfig(currentValue: number): {
|
|
15
|
-
type:
|
|
27
|
+
type: "green";
|
|
28
|
+
color: string;
|
|
29
|
+
icon: JSX.Element;
|
|
30
|
+
min: number;
|
|
31
|
+
max: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: "warning";
|
|
34
|
+
color: string;
|
|
35
|
+
icon: JSX.Element;
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
} | {
|
|
39
|
+
type: "red";
|
|
40
|
+
color: string;
|
|
41
|
+
icon: JSX.Element;
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
} | {
|
|
45
|
+
type: "unknown";
|
|
16
46
|
color: string;
|
|
17
47
|
icon: JSX.Element;
|
|
18
48
|
min: number;
|
|
@@ -5,7 +5,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
7
|
import { Caution, CheckmarkFilled } from '@carbon/react/icons/index.esm.js';
|
|
8
|
+
import { Check, TriangleAlert } from 'lucide-react';
|
|
8
9
|
import styled from 'styled-components';
|
|
10
|
+
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
9
11
|
import { Stack, Tooltip } from '../../ui/index.js';
|
|
10
12
|
import { C4ActionableNotification } from '../c4-actionable-notification/c4-actionable-notification.js';
|
|
11
13
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
@@ -13,6 +15,7 @@ import C4JobDashboardEntryPoint from '../c4-job-dashboard-entry-point/c4-job-das
|
|
|
13
15
|
import { Applications } from './applications.js';
|
|
14
16
|
import { ClusterDetails } from './cluster-details.js';
|
|
15
17
|
import { ClusterLoad } from './cluster-load.js';
|
|
18
|
+
import { DS_STATUS_ICON_COLORS, DsStatusIconText, } from './ds-status-icon-text.js';
|
|
16
19
|
const ResponsiveOverviewGrid = styled.div `
|
|
17
20
|
display: flex;
|
|
18
21
|
flex-direction: column;
|
|
@@ -56,6 +59,10 @@ export const C4ClusterOverview = ({ applications, details, clusterLoad, rbaNotif
|
|
|
56
59
|
return component;
|
|
57
60
|
};
|
|
58
61
|
export const C4IconAndTextElement = (props) => {
|
|
62
|
+
const designSystem = useC4DesignSystem();
|
|
63
|
+
if (designSystem === 'ds' && props.dsIcon) {
|
|
64
|
+
return (_jsx(DsStatusIconText, { status: props.dsIcon, style: props.style, children: props.tooltip ? (_jsx(Tooltip, { align: props.tooltip.align ?? 'bottom', autoAlign: true, label: props.tooltip.label, children: _jsx("span", { children: props.text }) })) : (props.text) }));
|
|
65
|
+
}
|
|
59
66
|
const component = (_jsx("div", { style: { ...props.style }, children: _jsxs("div", { style: { position: 'relative' }, children: [props.icon && (_jsx("div", { style: {
|
|
60
67
|
position: 'absolute',
|
|
61
68
|
top: '50%',
|
|
@@ -65,6 +72,27 @@ export const C4IconAndTextElement = (props) => {
|
|
|
65
72
|
}, children: props.icon })), _jsxs("span", { style: { paddingInlineStart: props.icon ? '1.2rem' : '0rem' }, children: [props.tooltip && (_jsx("span", { style: { zIndex: 999 }, children: _jsx(Tooltip, { align: props.tooltip.align ?? 'bottom', autoAlign: true, label: props.tooltip.label, children: _jsx("span", { children: props.text }) }) })), !props.tooltip && props.text] })] }) }));
|
|
66
73
|
return component;
|
|
67
74
|
};
|
|
75
|
+
/** Icon and color of each cluster load range in ds mode. */
|
|
76
|
+
const DS_CLUSTER_LOAD_PRESENTATION = {
|
|
77
|
+
green: { icon: Check, color: DS_STATUS_ICON_COLORS.success },
|
|
78
|
+
warning: { icon: TriangleAlert, color: DS_STATUS_ICON_COLORS.warning },
|
|
79
|
+
red: { icon: TriangleAlert, color: DS_STATUS_ICON_COLORS.danger },
|
|
80
|
+
unknown: { icon: TriangleAlert, color: DS_STATUS_ICON_COLORS.warning },
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The lucide icon and color for a cluster load in ds mode. It uses the same
|
|
84
|
+
* ranges as `getClusterLoadConfig`.
|
|
85
|
+
*/
|
|
86
|
+
export function getDsClusterLoadPresentation(currentValue) {
|
|
87
|
+
const { type } = getClusterLoadConfig(currentValue);
|
|
88
|
+
// The carbon ranges end below 1000 %, so a higher load is 'unknown' there.
|
|
89
|
+
// In ds mode, every load from the start of the red range up is critical.
|
|
90
|
+
const redMin = CLUSTER_LOAD_RANGES.find((range) => range.type === 'red')?.min;
|
|
91
|
+
const dsType = type === 'unknown' && redMin !== undefined && currentValue >= redMin
|
|
92
|
+
? 'red'
|
|
93
|
+
: type;
|
|
94
|
+
return DS_CLUSTER_LOAD_PRESENTATION[dsType];
|
|
95
|
+
}
|
|
68
96
|
export function getClusterLoadConfig(currentValue) {
|
|
69
97
|
const found = CLUSTER_LOAD_RANGES.find((entry) => {
|
|
70
98
|
return currentValue >= entry.min && currentValue < entry.max;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 { C3ClusterTag, } from '@camunda/camunda-composite-components';
|
|
8
2
|
import { Layer } from '@carbon/react';
|
|
9
3
|
import { Add, Information, Launch, Pause, Play, UpdateNow, WarningAltFilled, } from '@carbon/react/icons/index.esm.js';
|
|
10
4
|
import { useEffect, useRef, useState } from 'react';
|
|
11
5
|
import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
|
|
12
|
-
import { Button, CodeSnippet, Link, TextArea, Tooltip } from '../../ui/index.js';
|
|
6
|
+
import { Button, ClusterTag, CodeSnippet, Link, TextArea, Tooltip, } from '../../ui/index.js';
|
|
13
7
|
import { C4ActionableNotification } from '../c4-actionable-notification/c4-actionable-notification.js';
|
|
14
8
|
import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
15
9
|
import { C4StructuredListBody, C4StructuredListCell, C4StructuredListRow, C4StructuredListWrapper, } from '../c4-structured-list/c4-structured-list.js';
|
|
@@ -144,7 +138,7 @@ export const ClusterDetails = (props) => {
|
|
|
144
138
|
display: 'grid',
|
|
145
139
|
gridTemplateColumns: 'auto 1fr',
|
|
146
140
|
gap: '0.5rem',
|
|
147
|
-
}, children: props.tags.value?.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { children: props.tags.value.map((tag) => (_jsx(
|
|
141
|
+
}, children: props.tags.value?.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { children: props.tags.value.map((tag) => (_jsx(ClusterTag, { stage: tag }, `cluster-tag-${tag}`))) }), props.tags.updateVisible && (_jsx(C4LinkButton, { label: props.tags.updateTagLabel, onClick: () => props.tags?.updateAction(), style: { alignSelf: 'center' }, disabled: props.tags.updateDisabled }))] })) : (props.tags.updateVisible && (_jsx(C4LinkButton, { label: props.tags.addTagLabel, onClick: () => props.tags?.updateAction(), style: { alignSelf: 'center' }, icon: _jsx(Add, {}), disabled: props.tags.updateDisabled }))) }) })] })), props.regionId && (_jsxs(C4StructuredListRow, { style: rowStyle, children: [_jsx(C4StructuredListCell, { noWrap: true, children: props.regionId.label }), _jsx(C4StructuredListCell, { children: _jsx(ClusterDetailsIdValue, { value: props.regionId.value, copyLabel: props.copyValueLabel ?? 'Copy', copiedLabel: props.copyValueCopiedLabel ?? 'Copied!' }) })] })), props.backupRegionId && (_jsxs(C4StructuredListRow, { style: rowStyle, children: [_jsx(C4StructuredListCell, { noWrap: true, children: props.backupRegionId.label }), _jsx(C4StructuredListCell, { noWrap: true, children: _jsx(ClusterDetailsIdValue, { value: props.backupRegionId.value, copyLabel: props.copyValueLabel ?? 'Copy', copiedLabel: props.copyValueCopiedLabel ?? 'Copied!' }) })] })), _jsxs(C4StructuredListRow, { style: rowStyle, children: [_jsx(C4StructuredListCell, { noWrap: true, children: props.id.label }), _jsx(C4StructuredListCell, { noWrap: true, children: _jsx(ClusterDetailsIdValue, { value: props.id.value, copyLabel: props.copyValueLabel ?? 'Copy', copiedLabel: props.copyValueCopiedLabel ?? 'Copied!' }) })] }), props.swaggerUrl && (_jsxs(C4StructuredListRow, { style: rowStyle, children: [_jsx(C4StructuredListCell, { noWrap: true, children: props.swaggerUrl.label }), _jsx(C4StructuredListCell, { noWrap: true, children: _jsxs("span", { style: {
|
|
148
142
|
display: 'inline-flex',
|
|
149
143
|
alignItems: 'center',
|
|
150
144
|
gap: 'var(--cds-spacing-02)',
|
|
@@ -17,7 +17,7 @@ import { C4LinkButton } from '../c4-link-button/c4-link-button.js';
|
|
|
17
17
|
import { C4TileWithTitleAndAction } from '../c4-tile-with-title-and-action/c4-tile-with-title-and-action.js';
|
|
18
18
|
import { DsMeterChart } from '../shared-charts/ds-meter-chart.js';
|
|
19
19
|
import { DS_CHART_AXIS_COLOR, DS_CHART_GRID_COLOR, DS_CHART_TOOLTIP_PROPS, DS_STATUS_COLORS, getDsSeriesColor, } from '../shared-charts/recharts-tokens.js';
|
|
20
|
-
import { getClusterLoadConfig } from './c4-cluster-overview.js';
|
|
20
|
+
import { getClusterLoadConfig, getDsClusterLoadPresentation, } from './c4-cluster-overview.js';
|
|
21
21
|
export const ClusterLoad = (props) => {
|
|
22
22
|
const body = props.loading ? (_jsxs(_Fragment, { children: [_jsx(Loading, {}), _jsx("div", { style: { minHeight: '465px' } })] })) : (_jsxs(Stack, { gap: 3, children: [_jsx(LatestChart, { ...props }), _jsx("span", { style: { marginTop: '0.5rem' }, children: _jsx(C4Divider, {}) }), _jsx(HistoricChart, { ...props }), _jsx("span", { style: { marginTop: '0.75rem' }, children: _jsx(C4ExternalLink, { id: 'cluster-load-documentation', label: props.texts.docs, href: props.docs.url, onClick: () => {
|
|
23
23
|
props.docs.onClick();
|
|
@@ -323,6 +323,7 @@ export const MeterVisualization = (props) => {
|
|
|
323
323
|
color: currentValue > max ? CHART_COLORS.RED : CHART_COLORS.BLUE,
|
|
324
324
|
};
|
|
325
325
|
const currentClusterLoadConfig = getClusterLoadConfig(currentValue);
|
|
326
|
+
const DsLoadIcon = getDsClusterLoadPresentation(currentValue);
|
|
326
327
|
if (suspended) {
|
|
327
328
|
data.current = `${currentPrefix} n/a`;
|
|
328
329
|
}
|
|
@@ -361,7 +362,7 @@ export const MeterVisualization = (props) => {
|
|
|
361
362
|
display: 'grid',
|
|
362
363
|
gridTemplateColumns: '1fr auto',
|
|
363
364
|
width: '100%',
|
|
364
|
-
}, children: [_jsx("p", { children: data.current }), !suspended && (_jsx("p", { style: {
|
|
365
|
+
}, children: [_jsx("p", { children: data.current }), !suspended && designSystem === 'ds' && (_jsx("p", { style: { alignSelf: 'end', display: 'flex' }, children: _jsx(DsLoadIcon.icon, { className: 'size-4', style: { color: DsLoadIcon.color }, "aria-hidden": true }) })), !suspended && designSystem !== 'ds' && (_jsx("p", { style: {
|
|
365
366
|
color: currentClusterLoadConfig.color,
|
|
366
367
|
alignSelf: 'end',
|
|
367
368
|
}, children: currentClusterLoadConfig.icon }))] }), designSystem === 'ds' ? (_jsx(DsMeterChart, { value: currentValue, max: max, color: DS_CLUSTER_LOAD_ZONE_COLOR[currentClusterLoadConfig.type] ??
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type LucideProps } from 'lucide-react';
|
|
2
|
+
import type { ComponentType, CSSProperties, JSX, ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Icon colors for status indicators in ds mode. They are the
|
|
5
|
+
* `*-foreground-subtle` tokens that the DS `StatusIcon` uses. We do not use
|
|
6
|
+
* `StatusIcon` itself: it has four fixed glyphs, and a cluster status also
|
|
7
|
+
* needs a spinner, a pause and other icons. Do not use `DS_STATUS_COLORS` of
|
|
8
|
+
* the charts here: its `danger` (`--danger-action-default`) is a light tint in
|
|
9
|
+
* the light theme, and an icon in that color is almost invisible.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DS_STATUS_ICON_COLORS: {
|
|
12
|
+
readonly success: "var(--success-foreground-subtle)";
|
|
13
|
+
readonly danger: "var(--danger-foreground-subtle)";
|
|
14
|
+
readonly info: "var(--info-foreground-subtle)";
|
|
15
|
+
readonly warning: "var(--warning-foreground-subtle)";
|
|
16
|
+
readonly neutral: "var(--neutral-foreground-subtle)";
|
|
17
|
+
};
|
|
18
|
+
/** A lucide icon and its color, for a status indicator in ds mode. */
|
|
19
|
+
export interface DsStatusIcon {
|
|
20
|
+
icon: ComponentType<LucideProps>;
|
|
21
|
+
color: string;
|
|
22
|
+
}
|
|
23
|
+
/** Spins wherever it renders, so no caller has to special-case it. */
|
|
24
|
+
export declare function SpinningLoader({ className, ...props }: LucideProps): JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* The icon + text layout of the environment status in Hub, for ds mode only.
|
|
27
|
+
* Only the icon has the status color. The text stays neutral.
|
|
28
|
+
*/
|
|
29
|
+
export declare function DsStatusIconText(props: {
|
|
30
|
+
status: DsStatusIcon;
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 { LoaderCircle } from 'lucide-react';
|
|
8
|
+
/**
|
|
9
|
+
* Icon colors for status indicators in ds mode. They are the
|
|
10
|
+
* `*-foreground-subtle` tokens that the DS `StatusIcon` uses. We do not use
|
|
11
|
+
* `StatusIcon` itself: it has four fixed glyphs, and a cluster status also
|
|
12
|
+
* needs a spinner, a pause and other icons. Do not use `DS_STATUS_COLORS` of
|
|
13
|
+
* the charts here: its `danger` (`--danger-action-default`) is a light tint in
|
|
14
|
+
* the light theme, and an icon in that color is almost invisible.
|
|
15
|
+
*/
|
|
16
|
+
export const DS_STATUS_ICON_COLORS = {
|
|
17
|
+
success: 'var(--success-foreground-subtle)',
|
|
18
|
+
danger: 'var(--danger-foreground-subtle)',
|
|
19
|
+
info: 'var(--info-foreground-subtle)',
|
|
20
|
+
warning: 'var(--warning-foreground-subtle)',
|
|
21
|
+
neutral: 'var(--neutral-foreground-subtle)',
|
|
22
|
+
};
|
|
23
|
+
/** Spins wherever it renders, so no caller has to special-case it. */
|
|
24
|
+
export function SpinningLoader({ className, ...props }) {
|
|
25
|
+
return (_jsx(LoaderCircle, { className: `animate-spin ${className ?? ''}`, ...props }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The icon + text layout of the environment status in Hub, for ds mode only.
|
|
29
|
+
* Only the icon has the status color. The text stays neutral.
|
|
30
|
+
*/
|
|
31
|
+
export function DsStatusIconText(props) {
|
|
32
|
+
const { icon: Icon, color } = props.status;
|
|
33
|
+
return (_jsx("div", { style: props.style, children: _jsxs("span", { className: 'inline-flex items-center gap-1', children: [_jsx(Icon, { className: 'size-4 shrink-0', style: { color }, "aria-hidden": true }), _jsx("span", { className: 'inline-flex items-center gap-1 text-neutral-foreground-strong', children: props.children })] }) }));
|
|
34
|
+
}
|
|
@@ -4,15 +4,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
5
|
* You may not use this file except in compliance with the commercial license.
|
|
6
6
|
*/
|
|
7
|
-
import { C3ClusterTag } from '@camunda/camunda-composite-components';
|
|
8
7
|
import { Column, Grid } from '@carbon/react';
|
|
9
8
|
import * as Icons from '@carbon/react/icons/index.esm.js';
|
|
10
9
|
import { Chat, Help, WarningAltFilled } from '@carbon/react/icons/index.esm.js';
|
|
11
10
|
import { useCallback, useMemo, useState } from 'react';
|
|
12
|
-
import { Button, Link, Stack, Tile, Tooltip } from '../../ui/index.js';
|
|
11
|
+
import { Button, ClusterTag, Link, Stack, Tile, Tooltip } from '../../ui/index.js';
|
|
13
12
|
import { C4ActionableNotification } from '../c4-actionable-notification/c4-actionable-notification.js';
|
|
14
13
|
import { ClusterStatusElement } from '../c4-cluster-overview/applications.js';
|
|
15
|
-
import { C4IconAndTextElement, getClusterLoadConfig, } from '../c4-cluster-overview/c4-cluster-overview.js';
|
|
14
|
+
import { C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from '../c4-cluster-overview/c4-cluster-overview.js';
|
|
16
15
|
import { C4PageLayout } from '../c4-page-layout/c4-page-layout.js';
|
|
17
16
|
import { C4StructuredListBody, C4StructuredListCell, C4StructuredListHead, C4StructuredListRow, C4StructuredListWrapper, } from '../c4-structured-list/c4-structured-list.js';
|
|
18
17
|
import { ValueMetricsLineChart } from '../c4-usage-history/elements/usage-history-charts.js';
|
|
@@ -129,7 +128,7 @@ export const C4ConsoleDashboard = ({ orgId, embedded = false, usersAmount, taskU
|
|
|
129
128
|
return (_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { children: _jsx(Link, { href: urls.clusterDetails(item.id), onClick: (e) => {
|
|
130
129
|
e.preventDefault();
|
|
131
130
|
actions.onNavigateToClusterDetails(item.id);
|
|
132
|
-
}, children: item.name }) }), _jsx(C4StructuredListCell, { children: item.tags && (_jsx(
|
|
131
|
+
}, children: item.name }) }), _jsx(C4StructuredListCell, { children: item.tags && (_jsx(ClusterTag, { stage: item.tags })) }), _jsx(C4StructuredListCell, { children: _jsx(ClusterStatusElement, { status: item.status.toLowerCase() }) }), _jsx(C4StructuredListCell, { children: _jsx("div", { style: { position: 'relative' }, children: hasWarning ? (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
133
132
|
position: 'absolute',
|
|
134
133
|
top: '50%',
|
|
135
134
|
transform: 'translateY(-50%)',
|
|
@@ -139,7 +138,9 @@ export const C4ConsoleDashboard = ({ orgId, embedded = false, usersAmount, taskU
|
|
|
139
138
|
paddingInlineStart: '1.1rem',
|
|
140
139
|
}, children: item.version })] })) : (item.version) }) }), permissions.showClusterLoad && (_jsxs(C4StructuredListCell, { children: [hasClusterLoad &&
|
|
141
140
|
currentClusterLoadConfig &&
|
|
142
|
-
item.status !== 'Suspended' && (_jsx(C4IconAndTextElement, { text: `${currentClusterLoad.toFixed(2)}%`, color: currentClusterLoadConfig.color, icon: currentClusterLoadConfig.icon,
|
|
141
|
+
item.status !== 'Suspended' && (_jsx(C4IconAndTextElement, { text: `${currentClusterLoad.toFixed(2)}%`, color: currentClusterLoadConfig.color, icon: currentClusterLoadConfig.icon, dsIcon: getClusterLoadConfigProp
|
|
142
|
+
? undefined
|
|
143
|
+
: getDsClusterLoadPresentation(currentClusterLoad), tooltip: {
|
|
143
144
|
label: clusterLoadTooltip || '',
|
|
144
145
|
align: 'bottom',
|
|
145
146
|
} })), (!hasClusterLoad ||
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 { C3ClusterTag } from '@camunda/camunda-composite-components';
|
|
8
|
-
import { Stack, Tile } from '../../ui/index.js';
|
|
2
|
+
import { ClusterTag, Stack, Tile } from '../../ui/index.js';
|
|
9
3
|
import { HealthStatus } from '../c4-sm-dashboard/health-status.js';
|
|
10
4
|
import { C4StructuredListBody, C4StructuredListCell, C4StructuredListRow, C4StructuredListWrapper, } from '../c4-structured-list/c4-structured-list.js';
|
|
11
5
|
export const Details = (props) => {
|
|
@@ -21,5 +15,5 @@ const Tags = (props) => {
|
|
|
21
15
|
if (props.values.length === 0) {
|
|
22
16
|
return null;
|
|
23
17
|
}
|
|
24
|
-
return (_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '9rem' }, children: props.label }), _jsx(C4StructuredListCell, { children: props.values.map((tag) => (_jsx(
|
|
18
|
+
return (_jsxs(C4StructuredListRow, { children: [_jsx(C4StructuredListCell, { style: { width: '9rem' }, children: props.label }), _jsx(C4StructuredListCell, { children: props.values.map((tag) => (_jsx(ClusterTag, { stage: tag }, tag))) })] }));
|
|
25
19
|
};
|
|
@@ -31,9 +31,9 @@ export interface UsageHistoryChartsProps {
|
|
|
31
31
|
di?: LineChartConfig;
|
|
32
32
|
tu?: LineChartConfig;
|
|
33
33
|
/**
|
|
34
|
-
* Daily active tenants for the org. Set only when the
|
|
35
|
-
*
|
|
36
|
-
*
|
|
34
|
+
* Daily active tenants for the org. Set only when the org is on the 2025
|
|
35
|
+
* licensing model. A host can still omit it, so treat it as optional even for
|
|
36
|
+
* a 2025 org.
|
|
37
37
|
*/
|
|
38
38
|
tenants?: LineChartConfig;
|
|
39
39
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
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 { C3ClusterTag, } from '@camunda/camunda-composite-components';
|
|
8
2
|
import { Download } from '@carbon/react/icons/index.esm.js';
|
|
9
3
|
import { useMemo } from 'react';
|
|
10
|
-
import { Button, MultiSelect, Stack } from '../../ui/index.js';
|
|
4
|
+
import { Button, ClusterTag, MultiSelect, Stack } from '../../ui/index.js';
|
|
11
5
|
import { useDatePickerFamily } from '../../ui/families.js';
|
|
12
6
|
import { C4DataTable } from '../c4-data-table/c4-data-table.js';
|
|
13
7
|
import { C4DataTableSkeleton } from '../c4-data-table/c4-data-table-skeleton.js';
|
|
@@ -67,7 +61,7 @@ export const C4UsageMetricsPerCluster = ({ data, range, tags, texts, loading, do
|
|
|
67
61
|
type: 'wrapper',
|
|
68
62
|
options: {
|
|
69
63
|
wrapperOptions: {
|
|
70
|
-
wrapper: (row) => (_jsx("div", { children: row.tags?.length > 0 ? (row.tags.map((tag) => (_jsx(
|
|
64
|
+
wrapper: (row) => (_jsx("div", { children: row.tags?.length > 0 ? (row.tags.map((tag) => (_jsx(ClusterTag, { stage: tag }, tag)))) : (_jsx(_Fragment, { children: "-" })) })),
|
|
71
65
|
},
|
|
72
66
|
},
|
|
73
67
|
},
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
|
|
|
56
56
|
export type { C4ClusterListProps, ClusterListItem, ClusterListNotification, ClusterListPermissions, ClusterListUrls, } from './components/c4-cluster-list/c4-cluster-list.types.js';
|
|
57
57
|
export type { ApplicationsProps, ApplicationTileProps, ClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
58
58
|
export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
59
|
-
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
59
|
+
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
60
60
|
export type { C4ClusterOverviewProps, RbaNotificationProps, } from './components/c4-cluster-overview/c4-cluster-overview.types.js';
|
|
61
61
|
export type { ClusterDetailsGenerationUpdateProps, ClusterDetailsProps, } from './components/c4-cluster-overview/cluster-details.js';
|
|
62
62
|
export { C4ClusterSettings } from './components/c4-cluster-settings/c4-cluster-settings.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { C4ClusterDetailsIpWhitelist } from './components/c4-cluster-details-ip-
|
|
|
31
31
|
export { C4ClusterDetailsSecureConnectivity } from './components/c4-cluster-details-secure-connectivity/c4-cluster-details-secure-connectivity.js';
|
|
32
32
|
export { C4ClusterList } from './components/c4-cluster-list/c4-cluster-list.js';
|
|
33
33
|
export { ClusterStatusElement, normalizeClusterStatus, } from './components/c4-cluster-overview/applications.js';
|
|
34
|
-
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
34
|
+
export { C4ClusterOverview, C4IconAndTextElement, getClusterLoadConfig, getDsClusterLoadPresentation, } from './components/c4-cluster-overview/c4-cluster-overview.js';
|
|
35
35
|
export { C4ClusterSettings } from './components/c4-cluster-settings/c4-cluster-settings.js';
|
|
36
36
|
export { C4ClusterTagSelector } from './components/c4-cluster-tag-selector/c4-cluster-tag-selector.js';
|
|
37
37
|
export { C4ClustersEmptyState } from './components/c4-clusters-empty-state/c4-clusters-empty-state.js';
|
|
@@ -5,7 +5,11 @@ interface C4ConsoleEventsState {
|
|
|
5
5
|
}
|
|
6
6
|
export interface C4ConsoleEventsProviderProps {
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Set `false` to disable the live subscription, for example in Storybook or
|
|
10
|
+
* in tests. Default `true`. The provider also opens no stream for a QA user
|
|
11
|
+
* (`useIsQaUser`).
|
|
12
|
+
*/
|
|
9
13
|
live?: boolean;
|
|
10
14
|
}
|
|
11
15
|
export declare const C4ConsoleEventsProvider: ({ children, live, }: C4ConsoleEventsProviderProps) => React.JSX.Element;
|
|
@@ -8,6 +8,7 @@ import { ExternalConsoleService, } from '@camunda/ccma-api';
|
|
|
8
8
|
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
import { useC4ConsoleRuntime } from './c4-console-runtime-context.js';
|
|
10
10
|
import { toApiConfig } from './to-api-config.js';
|
|
11
|
+
import { useIsQaUser } from './use-is-qa-user.js';
|
|
11
12
|
/**
|
|
12
13
|
* Bridges the Console org/cluster SSE stream to the `clusterchange` window
|
|
13
14
|
* event that `C4ConsoleDataProvider` (and legacy c3 `useClusterUpdate`
|
|
@@ -24,9 +25,19 @@ const EventsContext = createContext(undefined);
|
|
|
24
25
|
let mountedBridgeCount = 0;
|
|
25
26
|
export const C4ConsoleEventsProvider = ({ children, live = true, }) => {
|
|
26
27
|
const runtime = useC4ConsoleRuntime();
|
|
28
|
+
// An automated QA run opens a new browser for each test, and no test reads
|
|
29
|
+
// the stream. The stream waits until the provider knows the user is no QA user.
|
|
30
|
+
const isQaUser = useIsQaUser(runtime);
|
|
31
|
+
const connects = live && isQaUser === false;
|
|
27
32
|
const [state, setState] = useState(live ? 'connecting' : 'closed');
|
|
33
|
+
// The provider opens no stream in these two cases, thus its state is closed.
|
|
28
34
|
useEffect(() => {
|
|
29
|
-
if (!live ||
|
|
35
|
+
if (!live || isQaUser) {
|
|
36
|
+
setState('closed');
|
|
37
|
+
}
|
|
38
|
+
}, [live, isQaUser]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!connects || typeof window === 'undefined') {
|
|
30
41
|
return;
|
|
31
42
|
}
|
|
32
43
|
mountedBridgeCount += 1;
|
|
@@ -37,6 +48,9 @@ export const C4ConsoleEventsProvider = ({ children, live = true, }) => {
|
|
|
37
48
|
'double-dispatches SSE events. Mount exactly one. See ' +
|
|
38
49
|
'packages/c4/docs/runtime.md.');
|
|
39
50
|
}
|
|
51
|
+
// `connectSse` starts in `connecting` but does not report it. After a QA
|
|
52
|
+
// session the state is `closed`, and it would stay so until the stream opens.
|
|
53
|
+
setState('connecting');
|
|
40
54
|
const connection = ExternalConsoleService.streamOrgEvents({
|
|
41
55
|
config: toApiConfig(runtime),
|
|
42
56
|
onStateChange: setState,
|
|
@@ -48,7 +62,7 @@ export const C4ConsoleEventsProvider = ({ children, live = true, }) => {
|
|
|
48
62
|
mountedBridgeCount -= 1;
|
|
49
63
|
connection.close();
|
|
50
64
|
};
|
|
51
|
-
}, [
|
|
65
|
+
}, [connects, runtime]);
|
|
52
66
|
const value = useMemo(() => ({ state }), [state]);
|
|
53
67
|
return (_jsx(EventsContext.Provider, { value: value, children: children }));
|
|
54
68
|
};
|