@centreon/ui 25.11.4 → 25.11.6
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/package.json +3 -3
- package/public/mockServiceWorker.js +8 -31
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +1 -0
- package/src/Graph/Chart/Chart.cypress.spec.tsx +5 -5
- package/src/Graph/Chart/Chart.tsx +1 -0
- package/src/Graph/Chart/Legend/LegendHeader.tsx +1 -1
- package/src/Graph/Chart/Legend/index.tsx +8 -3
- package/src/Graph/common/BaseChart/BaseChart.tsx +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "25.11.
|
|
3
|
+
"version": "25.11.6",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update:deps": "pnpx npm-check-updates -i --format group",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@storybook/test": "^8.6.3",
|
|
76
76
|
"@storybook/test-runner": "^0.22.0",
|
|
77
77
|
"@storybook/theming": "^8.6.3",
|
|
78
|
-
"@tailwindcss/cli": "^4.1.
|
|
78
|
+
"@tailwindcss/cli": "^4.1.17",
|
|
79
79
|
"@tailwindcss/postcss": "^4.1.7",
|
|
80
80
|
"@tailwindcss/vite": "^4.1.7",
|
|
81
81
|
"@testing-library/cypress": "^10.0.3",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"storybook-dark-mode": "^4.0.2",
|
|
107
107
|
"storybook-react-rsbuild": "^1.0.1",
|
|
108
108
|
"style-dictionary": "^4.3.3",
|
|
109
|
-
"tailwindcss": "^4.1.
|
|
109
|
+
"tailwindcss": "^4.1.17",
|
|
110
110
|
"ts-node": "^10.9.2",
|
|
111
111
|
"use-resize-observer": "^9.1.0",
|
|
112
112
|
"vite": "^6.3.5",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.
|
|
12
|
-
const INTEGRITY_CHECKSUM = '
|
|
11
|
+
const PACKAGE_VERSION = '2.2.14'
|
|
12
|
+
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
|
15
15
|
|
|
@@ -62,12 +62,7 @@ self.addEventListener('message', async function (event) {
|
|
|
62
62
|
|
|
63
63
|
sendToClient(client, {
|
|
64
64
|
type: 'MOCKING_ENABLED',
|
|
65
|
-
payload:
|
|
66
|
-
client: {
|
|
67
|
-
id: client.id,
|
|
68
|
-
frameType: client.frameType,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
65
|
+
payload: true,
|
|
71
66
|
})
|
|
72
67
|
break
|
|
73
68
|
}
|
|
@@ -160,10 +155,6 @@ async function handleRequest(event, requestId) {
|
|
|
160
155
|
async function resolveMainClient(event) {
|
|
161
156
|
const client = await self.clients.get(event.clientId)
|
|
162
157
|
|
|
163
|
-
if (activeClientIds.has(event.clientId)) {
|
|
164
|
-
return client
|
|
165
|
-
}
|
|
166
|
-
|
|
167
158
|
if (client?.frameType === 'top-level') {
|
|
168
159
|
return client
|
|
169
160
|
}
|
|
@@ -192,26 +183,12 @@ async function getResponse(event, client, requestId) {
|
|
|
192
183
|
const requestClone = request.clone()
|
|
193
184
|
|
|
194
185
|
function passthrough() {
|
|
195
|
-
|
|
196
|
-
// so the headers can be manipulated with.
|
|
197
|
-
const headers = new Headers(requestClone.headers)
|
|
198
|
-
|
|
199
|
-
// Remove the "accept" header value that marked this request as passthrough.
|
|
200
|
-
// This prevents request alteration and also keeps it compliant with the
|
|
201
|
-
// user-defined CORS policies.
|
|
202
|
-
const acceptHeader = headers.get('accept')
|
|
203
|
-
if (acceptHeader) {
|
|
204
|
-
const values = acceptHeader.split(',').map((value) => value.trim())
|
|
205
|
-
const filteredValues = values.filter(
|
|
206
|
-
(value) => value !== 'msw/passthrough',
|
|
207
|
-
)
|
|
186
|
+
const headers = Object.fromEntries(requestClone.headers.entries())
|
|
208
187
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
}
|
|
188
|
+
// Remove internal MSW request header so the passthrough request
|
|
189
|
+
// complies with any potential CORS preflight checks on the server.
|
|
190
|
+
// Some servers forbid unknown request headers.
|
|
191
|
+
delete headers['x-msw-intention']
|
|
215
192
|
|
|
216
193
|
return fetch(requestClone, { headers })
|
|
217
194
|
}
|
|
@@ -154,7 +154,7 @@ const initializeCustomUnits = ({
|
|
|
154
154
|
const checkGraphWidth = (): void => {
|
|
155
155
|
cy.findByTestId('graph-interaction-zone')
|
|
156
156
|
.should('have.attr', 'height')
|
|
157
|
-
.and('equal', '
|
|
157
|
+
.and('equal', '387');
|
|
158
158
|
|
|
159
159
|
cy.findByTestId('graph-interaction-zone').then((graph) => {
|
|
160
160
|
expect(Number(graph[0].attributes.width.value)).to.be.greaterThan(1170);
|
|
@@ -452,7 +452,7 @@ describe('Line chart', () => {
|
|
|
452
452
|
|
|
453
453
|
cy.contains(':00 AM').should('be.visible');
|
|
454
454
|
|
|
455
|
-
cy.get('text[transform="rotate(-35, -2,
|
|
455
|
+
cy.get('text[transform="rotate(-35, -2, 204.60871164646406)"]').should(
|
|
456
456
|
'be.visible'
|
|
457
457
|
);
|
|
458
458
|
|
|
@@ -534,7 +534,7 @@ describe('Line chart', () => {
|
|
|
534
534
|
checkGraphWidth();
|
|
535
535
|
cy.contains(':00 AM').should('be.visible');
|
|
536
536
|
cy.get('circle[cx="248.33333333333334"]').should('be.visible');
|
|
537
|
-
cy.get('circle[cy="
|
|
537
|
+
cy.get('circle[cy="225.07536552649066"]').should('be.visible');
|
|
538
538
|
|
|
539
539
|
cy.makeSnapshot();
|
|
540
540
|
});
|
|
@@ -748,10 +748,10 @@ describe('Lines and bars', () => {
|
|
|
748
748
|
checkGraphWidth();
|
|
749
749
|
|
|
750
750
|
cy.get(
|
|
751
|
-
'path[d="M7.501377410468319,
|
|
751
|
+
'path[d="M7.501377410468319,286.2259761383722 h56.51239669421488 h1v1 v98.77402386162782 a1,1 0 0 1 -1,1 h-56.51239669421488 a1,1 0 0 1 -1,-1 v-98.77402386162782 v-1h1z"]'
|
|
752
752
|
).should('be.visible');
|
|
753
753
|
cy.get(
|
|
754
|
-
'path[d="M24.05509641873278,
|
|
754
|
+
'path[d="M24.05509641873278,232.36514618046195 h23.404958677685954 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,17.553719008264462 v18.753391941381302 v17.553719008264462h-17.553719008264462 h-23.404958677685954 h-17.553719008264462v-17.553719008264462 v-18.753391941381302 a17.553719008264462,17.553719008264462 0 0 1 17.553719008264462,-17.553719008264462z"]'
|
|
755
755
|
).should('be.visible');
|
|
756
756
|
|
|
757
757
|
cy.makeSnapshot();
|
|
@@ -64,7 +64,7 @@ const LegendHeader = ({
|
|
|
64
64
|
>
|
|
65
65
|
<div className="flex items-center gap-1">
|
|
66
66
|
<EllipsisTypography
|
|
67
|
-
className="text-xs leading-
|
|
67
|
+
className="text-xs leading-[1.2] font-medium"
|
|
68
68
|
containerClassname={`w-auto ${(!isListMode || (isListMode && isDisplayedOnSide)) && 'max-w-[166px]'}`}
|
|
69
69
|
data-mode={
|
|
70
70
|
value ? LegendDisplayMode.Compact : LegendDisplayMode.Normal
|
|
@@ -38,6 +38,7 @@ interface Props
|
|
|
38
38
|
metricId: number | string;
|
|
39
39
|
position: [number, number];
|
|
40
40
|
}) => void;
|
|
41
|
+
graphHeight: number;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
const MainLegend = ({
|
|
@@ -55,7 +56,8 @@ const MainLegend = ({
|
|
|
55
56
|
max: true,
|
|
56
57
|
avg: true
|
|
57
58
|
},
|
|
58
|
-
secondaryClick
|
|
59
|
+
secondaryClick,
|
|
60
|
+
graphHeight
|
|
59
61
|
}: Props): ReactElement => {
|
|
60
62
|
const theme = useTheme();
|
|
61
63
|
|
|
@@ -122,7 +124,10 @@ const MainLegend = ({
|
|
|
122
124
|
data-display-side={!equals(placement, 'bottom')}
|
|
123
125
|
>
|
|
124
126
|
<ul
|
|
125
|
-
className={`list-none flex gap-3 w-full ${!isListMode && equals(placement, 'bottom') && 'flex-wrap'} ${
|
|
127
|
+
className={`list-none flex gap-3 w-full ${!isListMode && equals(placement, 'bottom') && 'flex-wrap'} ${isListMode || !equals(placement, 'bottom') ? 'flex-col h-full w-fit' : ''} ${equals(placement, 'bottom') ? 'max-h-17' : 'max-h-0'}`}
|
|
128
|
+
style={{
|
|
129
|
+
height: equals(placement, 'bottom') ? 'auto' : `${graphHeight}px`
|
|
130
|
+
}}
|
|
126
131
|
data-as-list={isListMode || !equals(placement, 'bottom')}
|
|
127
132
|
data-mode={itemMode}
|
|
128
133
|
>
|
|
@@ -161,7 +166,7 @@ const MainLegend = ({
|
|
|
161
166
|
onContextMenu={contextMenuClick(metric_id)}
|
|
162
167
|
>
|
|
163
168
|
<div
|
|
164
|
-
className="h-full rounded-sm w-1"
|
|
169
|
+
className="h-full rounded-sm w-1 min-h-5"
|
|
165
170
|
style={{ backgroundColor: markerColor }}
|
|
166
171
|
data-icon
|
|
167
172
|
/>
|
|
@@ -35,9 +35,10 @@ interface Props {
|
|
|
35
35
|
limitLegend?: number | false;
|
|
36
36
|
lines: Array<Line>;
|
|
37
37
|
setLines:
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
| Dispatch<SetStateAction<Array<Line> | null>>
|
|
39
|
+
| Dispatch<SetStateAction<Array<Line>>>;
|
|
40
40
|
title: string;
|
|
41
|
+
graphHeight: number;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
const BaseChart = ({
|
|
@@ -53,7 +54,8 @@ const BaseChart = ({
|
|
|
53
54
|
titleRef,
|
|
54
55
|
title,
|
|
55
56
|
header,
|
|
56
|
-
isHorizontal = true
|
|
57
|
+
isHorizontal = true,
|
|
58
|
+
graphHeight
|
|
57
59
|
}: Props): JSX.Element => {
|
|
58
60
|
const { classes, cx } = useBaseChartStyles();
|
|
59
61
|
|
|
@@ -91,8 +93,8 @@ const BaseChart = ({
|
|
|
91
93
|
className={cx(
|
|
92
94
|
classes.legendContainer,
|
|
93
95
|
equals(legend?.placement, 'right') &&
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
!isHorizontal &&
|
|
97
|
+
classes.legendContainerVerticalSide
|
|
96
98
|
)}
|
|
97
99
|
ref={legendRef}
|
|
98
100
|
>
|
|
@@ -110,6 +112,7 @@ const BaseChart = ({
|
|
|
110
112
|
}
|
|
111
113
|
showCalculations={legend?.showCalculations}
|
|
112
114
|
secondaryClick={legend?.secondaryClick}
|
|
115
|
+
graphHeight={graphHeight}
|
|
113
116
|
/>
|
|
114
117
|
</div>
|
|
115
118
|
)}
|
|
@@ -133,6 +136,7 @@ const BaseChart = ({
|
|
|
133
136
|
shouldDisplayLegendInCompactMode={shouldDisplayLegendInCompactMode}
|
|
134
137
|
secondaryClick={legend?.secondaryClick}
|
|
135
138
|
showCalculations={legend?.showCalculations}
|
|
139
|
+
graphHeight={graphHeight}
|
|
136
140
|
/>
|
|
137
141
|
</div>
|
|
138
142
|
)}
|