@centreon/ui 25.10.2-dev-25-10-x.0 → 25.10.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.10.2-dev-25-10-x.0",
3
+ "version": "25.10.2",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -8,8 +8,8 @@
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const PACKAGE_VERSION = '2.7.3'
12
- const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
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
- // Cast the request headers to a new Headers instance
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
- if (filteredValues.length > 0) {
210
- headers.set('accept', filteredValues.join(', '))
211
- } else {
212
- headers.delete('accept')
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
  }
@@ -1,3 +1,5 @@
1
+ import { ReactElement } from 'react';
2
+
1
3
  import Typography from '@mui/material/Typography';
2
4
 
3
5
  import { useMemoComponent } from '@centreon/ui';
@@ -10,7 +12,7 @@ interface Props {
10
12
  title: string;
11
13
  }
12
14
 
13
- const Header = ({ title, header }: Props): JSX.Element => {
15
+ const Header = ({ title, header }: Props): ReactElement => {
14
16
  const { classes } = ussHeaderChartStyles();
15
17
 
16
18
  const displayTitle = header?.displayTitle ?? true;
@@ -6,6 +6,7 @@ export { default as BarChart } from './BarChart/BarChart';
6
6
  export { Gauge } from './Gauge';
7
7
  export { SingleBar } from './SingleBar';
8
8
  export { Text as GraphText } from './Text';
9
+ export { default as Header } from './common/BaseChart/Header';
9
10
 
10
11
  export { HeatMap } from './HeatMap';
11
12
  export { BarStack } from './BarStack';
@@ -0,0 +1,49 @@
1
+ @layer base {
2
+ ::-webkit-scrollbar {
3
+ height: var(--spacing-2);
4
+ width: var(--spacing-2);
5
+ background-color: transparent;
6
+ }
7
+
8
+ ::-webkit-scrollbar-thumb {
9
+ background-color: var(--color-text-disabled);
10
+ border-radius: var(--spacing-1);
11
+ }
12
+
13
+ ::-webkit-scrollbar-thumb:hover {
14
+ background-color: var(--color-primary-main);
15
+ }
16
+
17
+ * {
18
+ scrollbar-color: var(--color-text-disabled) var(--color-background-default);
19
+ scrollbar-width: thin;
20
+ }
21
+
22
+ html {
23
+ margin: 0;
24
+ padding: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ text-rendering: optimizeLegibility;
28
+ }
29
+
30
+ body {
31
+ background-color: var(--color-background-paper);
32
+ height: 100%;
33
+ padding: 0;
34
+ width: 100%;
35
+ }
36
+
37
+ #root {
38
+ background-color: var(--color-background-paper) !important;
39
+ }
40
+
41
+ @variant dark {
42
+ ::-webkit-scrollbar-thumb {
43
+ background-color: var(--color-divider);
44
+ }
45
+ * {
46
+ scrollbar-color: var(--color-divider) var(--color-background-default);
47
+ }
48
+ }
49
+ }
@@ -26,7 +26,7 @@ import { ReactNode, useMemo } from 'react';
26
26
  import { getPalette } from './palettes';
27
27
 
28
28
  declare module '@mui/styles/defaultTheme' {
29
- interface DefaultTheme extends Theme {}
29
+ interface DefaultTheme extends Theme { }
30
30
  }
31
31
 
32
32
  declare module '@mui/material/TextField' {
@@ -147,46 +147,6 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
147
147
  },
148
148
  MuiCssBaseline: {
149
149
  styleOverrides: (theme) => `
150
- ::-webkit-scrollbar {
151
- height: ${theme.spacing(1)};
152
- width: ${theme.spacing(1)};
153
- background-color: transparent;
154
- }
155
- ::-webkit-scrollbar-thumb {
156
- background-color: ${
157
- equals(mode, 'dark')
158
- ? theme.palette.divider
159
- : theme.palette.text.disabled
160
- };
161
- border-radius: ${theme.spacing(0.5)};
162
- }
163
- ::-webkit-scrollbar-thumb:hover {
164
- background-color: ${theme.palette.primary.main};
165
- }
166
- * {
167
- scrollbar-color: ${
168
- equals(mode, 'dark')
169
- ? theme.palette.divider
170
- : theme.palette.text.disabled
171
- } ${theme.palette.background.default};
172
- scrollbar-width: thin;
173
- }
174
- html {
175
- margin: 0;
176
- padding: 0;
177
- width: 100%;
178
- height: 100%;
179
- text-rendering: optimizeLegibility;
180
- }
181
- body {
182
- background-color: ${theme.palette.background.paper};
183
- height: 100%;
184
- padding: 0;
185
- width: 100%;
186
- }
187
- #root {
188
- background-color: ${theme.palette.background.paper};
189
- }
190
150
  @font-face {
191
151
  font-family: 'Roboto';
192
152
  font-style: normal;
@@ -211,6 +171,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
211
171
  font-weight: 700;
212
172
  src: local('Roboto'), local('Roboto-Bold'), url(${RobotoBoldWoff2}) format('woff2');
213
173
  }
174
+ body {
175
+ background-color: ${theme.palette.background.paper};
176
+ }
214
177
  `
215
178
  },
216
179
  MuiInputBase: {
@@ -235,14 +198,14 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
235
198
  styleOverrides: {
236
199
  root: ({ theme }) => ({
237
200
  '&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected:focus':
238
- {
239
- background: equals(theme.palette.mode, ThemeMode.dark)
240
- ? theme.palette.primary.dark
241
- : theme.palette.primary.light,
242
- color: equals(theme.palette.mode, ThemeMode.dark)
243
- ? theme.palette.common.white
244
- : theme.palette.primary.main
245
- },
201
+ {
202
+ background: equals(theme.palette.mode, ThemeMode.dark)
203
+ ? theme.palette.primary.dark
204
+ : theme.palette.primary.light,
205
+ color: equals(theme.palette.mode, ThemeMode.dark)
206
+ ? theme.palette.common.white
207
+ : theme.palette.primary.main
208
+ },
246
209
  fontSize: theme.typography.body2.fontSize
247
210
  })
248
211
  }
@@ -259,12 +222,12 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
259
222
  styleOverrides: {
260
223
  root: ({ theme }) => ({
261
224
  [`[role="tooltip"] &, &.MuiMenu-paper, &.${autocompleteClasses.paper}`]:
262
- {
263
- backgroundColor: theme.palette.background.default,
264
- border: 'none',
265
- borderRadius: `${theme.shape.borderRadius}px`,
266
- boxShadow: theme.shadows[3]
267
- }
225
+ {
226
+ backgroundColor: theme.palette.background.default,
227
+ border: 'none',
228
+ borderRadius: `${theme.shape.borderRadius}px`,
229
+ boxShadow: theme.shadows[3]
230
+ }
268
231
  })
269
232
  }
270
233
  },
@@ -1,10 +1,13 @@
1
1
  @import "tailwindcss";
2
+ @import "./base.css"; /* Base styles: scrollbar, html, body, #root */
2
3
 
3
4
  @custom-variant dark (&:where(.dark, .dark *));
4
5
 
5
6
  @theme {
7
+ /* Typography */
6
8
  --font-body: Roboto, Arial, serif;
7
9
 
10
+ /* Spacing system */
8
11
  --spacing: 4px;
9
12
 
10
13
  --spacing-0: calc(var(--spacing) * 0);
@@ -19,6 +22,11 @@
19
22
  --spacing-9: calc(var(--spacing) * 9);
20
23
  --spacing-10: calc(var(--spacing) * 10);
21
24
 
25
+ /* =============
26
+ COLOR SYSTEM
27
+ ============= */
28
+
29
+ /* Action colors */
22
30
  --color-action-acknowledged: #745f35;
23
31
  --color-action-acknowledged-background: #dfd2b9;
24
32
  --color-action-in-flapping: #064a3f;
@@ -35,6 +43,8 @@
35
43
  --color-action-in-downtime-background: #e5d8f3;
36
44
  --color-action-selected: rgba(102, 102, 102, 0.3);
37
45
  --color-action-selected-opacity: 0.3;
46
+
47
+ /* Background colors */
38
48
  --color-background-default: #f4f4f4;
39
49
  --color-background-listing-header: #666666;
40
50
  --color-background-panel: #ededed;
@@ -42,13 +52,19 @@
42
52
  --color-background-paper: #ffffff;
43
53
  --color-background-tooltip: #434e58;
44
54
  --color-background-widget: #f8f8f8;
55
+
56
+ /* Chip colors */
45
57
  --color-chip-error: #ff6666;
46
58
  --color-chip-info: #1588d1;
47
59
  --color-chip-neutral: #6da4e4;
48
60
  --color-chip-success: #88b922;
49
61
  --color-chip-warning: #fd9b27;
62
+
63
+ /* Utility colors */
50
64
  --color-divider: #e3e3e3;
51
65
  --color-error-main: #ff4a4a;
66
+
67
+ /* Header colors */
52
68
  --color-header-page-action-background-active: #1975d10f;
53
69
  --color-header-page-action-background-default: #ffffff00;
54
70
  --color-header-page-action-color-active: #1976d2;
@@ -74,13 +90,19 @@
74
90
  --color-header-menu-item-color-active: #3e85d5;
75
91
  --color-header-menu-item-color-default: #1b2127;
76
92
  --color-header-menu-item-color-hover: #101418;
93
+
94
+ /* State colors */
77
95
  --color-pending-main: #1ebeb3;
96
+
97
+ /* Primary & Secondary colors */
78
98
  --color-primary-main: #2e68aa;
79
99
  --color-primary-light: #cde7fc;
80
100
  --color-primary-dark: #255891;
81
101
  --color-secondary-main: #c772d6;
82
102
  --color-secondary-light: #e5a5f0;
83
103
  --color-secondary-dark: #ac28c1;
104
+
105
+ /* Status colors */
84
106
  --color-status-background-error: #ff6666;
85
107
  --color-status-background-none: --alpha(#2e68aa / 10%);
86
108
  --color-status-background-pending: #1ebeb3;
@@ -88,12 +110,16 @@
88
110
  --color-stauts-background-unknown: #e3e3e3;
89
111
  --color-status-background-warning: #fd9b27;
90
112
  --color-success-main: #88b922;
113
+
114
+ /* Text colors */
91
115
  --color-text-disabled: #999999;
92
116
  --color-text-primary: #000000;
93
117
  --color-text-secondary: #666666;
94
118
  --color-warning-main: #fd9b27;
95
119
  --color-warning-light: #fcc481;
96
120
  --color-warning-dark: #fc7e00;
121
+
122
+ /* Base colors */
97
123
  --color-white: #ffffff;
98
124
  --color-black: #000000;
99
125
  }
@@ -36,6 +36,7 @@ interface UseMetricsQueryProps {
36
36
  start?: string | null;
37
37
  timePeriodType: number;
38
38
  };
39
+ isEnabled?: boolean;
39
40
  }
40
41
 
41
42
  interface UseMetricsQueryState {
@@ -101,7 +102,8 @@ const useGraphQuery = ({
101
102
  refreshInterval = false,
102
103
  refreshCount,
103
104
  bypassQueryParams = false,
104
- prefix
105
+ prefix,
106
+ isEnabled = true
105
107
  }: UseMetricsQueryProps): UseMetricsQueryState => {
106
108
  const timePeriodToUse = equals(timePeriod?.timePeriodType, -1)
107
109
  ? {
@@ -158,7 +160,10 @@ const useGraphQuery = ({
158
160
  refreshCount || 0
159
161
  ],
160
162
  queryOptions: {
161
- enabled: areResourcesFullfilled(resources) && !isEmpty(definedMetrics),
163
+ enabled:
164
+ areResourcesFullfilled(resources) &&
165
+ !isEmpty(definedMetrics) &&
166
+ isEnabled,
162
167
  refetchInterval: refreshInterval,
163
168
  suspense: false
164
169
  },