@centreon/ui 25.10.9 → 25.10.11

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.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/public/mockServiceWorker.js +8 -31
  3. package/src/Form/Inputs/ConnectedAutocomplete.tsx +2 -0
  4. package/src/Form/Inputs/Grid.tsx +2 -3
  5. package/src/Form/Inputs/models.ts +2 -0
  6. package/src/Form/Section/navigateToSection.ts +6 -6
  7. package/src/Graph/BarChart/BarChart.cypress.spec.tsx +55 -92
  8. package/src/Graph/BarChart/BarChart.stories.tsx +1 -42
  9. package/src/Graph/BarChart/BarChart.tsx +1 -1
  10. package/src/Graph/BarChart/BarStack.tsx +26 -15
  11. package/src/Graph/BarChart/MemoizedGroup.tsx +8 -7
  12. package/src/Graph/BarChart/ResponsiveBarChart.tsx +1 -2
  13. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +5 -4
  14. package/src/Graph/Chart/BasicComponents/Lines/index.tsx +94 -94
  15. package/src/Graph/Chart/Chart.cypress.spec.tsx +6 -25
  16. package/src/Graph/Chart/Chart.stories.tsx +1 -34
  17. package/src/Graph/Chart/Chart.tsx +6 -5
  18. package/src/Graph/Chart/Legend/index.tsx +2 -26
  19. package/src/Graph/Chart/index.tsx +28 -24
  20. package/src/Graph/Chart/models.ts +1 -6
  21. package/src/Graph/Chart/translatedLabels.ts +1 -0
  22. package/src/Graph/Chart/useChartData.ts +1 -1
  23. package/src/Graph/common/BaseChart/BaseChart.tsx +1 -6
  24. package/src/Graph/common/BaseChart/Header/index.tsx +3 -1
  25. package/src/Graph/common/Error/NoData.tsx +18 -0
  26. package/src/Graph/common/timeSeries/index.test.ts +4 -4
  27. package/src/Graph/common/timeSeries/index.ts +77 -73
  28. package/src/Graph/common/utils.ts +4 -10
  29. package/src/Graph/index.ts +20 -19
  30. package/src/InputField/Select/Autocomplete/Connected/index.tsx +7 -7
  31. package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +1 -1
  32. package/src/InputField/Select/Autocomplete/index.tsx +28 -17
  33. package/src/InputField/Select/Option.tsx +3 -3
  34. package/src/InputField/Select/index.tsx +2 -1
  35. package/src/Module/index.tsx +2 -8
  36. package/src/ThemeProvider/index.tsx +21 -30
  37. package/src/ThemeProvider/tailwindcss.css +10 -10
  38. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +4 -3
  39. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +15 -10
  40. package/src/components/Menu/Button/MenuButton.tsx +1 -2
  41. package/src/components/Modal/Modal.styles.ts +2 -1
  42. package/src/components/Modal/ModalHeader.tsx +1 -5
  43. package/src/Graph/mockedData/dataWithMissingPoint.json +0 -74
@@ -1,12 +1,11 @@
1
1
  import { useAtomValue } from 'jotai';
2
- import { equals, mergeDeepRight } from 'ramda';
2
+ import { equals } from 'ramda';
3
3
  import { CSSInterpolation } from 'tss-react';
4
4
 
5
5
  import {
6
6
  ButtonProps,
7
7
  InputBaseProps,
8
8
  ThemeProvider as MuiThemeProvider,
9
- PaletteOptions,
10
9
  StyledEngineProvider,
11
10
  Theme,
12
11
  createTheme
@@ -27,7 +26,7 @@ import { ReactNode, useMemo } from 'react';
27
26
  import { getPalette } from './palettes';
28
27
 
29
28
  declare module '@mui/styles/defaultTheme' {
30
- interface DefaultTheme extends Theme {}
29
+ interface DefaultTheme extends Theme { }
31
30
  }
32
31
 
33
32
  declare module '@mui/material/TextField' {
@@ -199,14 +198,14 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
199
198
  styleOverrides: {
200
199
  root: ({ theme }) => ({
201
200
  '&:hover, &.Mui-selected, &.Mui-selected:hover, &.Mui-selected:focus':
202
- {
203
- background: equals(theme.palette.mode, ThemeMode.dark)
204
- ? theme.palette.primary.dark
205
- : theme.palette.primary.light,
206
- color: equals(theme.palette.mode, ThemeMode.dark)
207
- ? theme.palette.common.white
208
- : theme.palette.primary.main
209
- },
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
+ },
210
209
  fontSize: theme.typography.body2.fontSize
211
210
  })
212
211
  }
@@ -223,12 +222,12 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
223
222
  styleOverrides: {
224
223
  root: ({ theme }) => ({
225
224
  [`[role="tooltip"] &, &.MuiMenu-paper, &.${autocompleteClasses.paper}`]:
226
- {
227
- backgroundColor: theme.palette.background.default,
228
- border: 'none',
229
- borderRadius: `${theme.shape.borderRadius}px`,
230
- boxShadow: theme.shadows[3]
231
- }
225
+ {
226
+ backgroundColor: theme.palette.background.default,
227
+ border: 'none',
228
+ borderRadius: `${theme.shape.borderRadius}px`,
229
+ boxShadow: theme.shadows[3]
230
+ }
232
231
  })
233
232
  }
234
233
  },
@@ -258,23 +257,15 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
258
257
 
259
258
  interface Props {
260
259
  children: ReactNode;
261
- overrideTheme?: {
262
- light: Partial<PaletteOptions>;
263
- dark: Partial<PaletteOptions>;
264
- };
265
260
  }
266
261
 
267
- const ThemeProvider = ({ children, overrideTheme }: Props): JSX.Element => {
262
+ const ThemeProvider = ({ children }: Props): JSX.Element => {
268
263
  const { themeMode } = useAtomValue(userAtom);
269
264
 
270
- const theme = useMemo(() => {
271
- const overrideThemeByMode = overrideTheme?.[themeMode || 'light'];
272
- return createTheme(
273
- mergeDeepRight(getTheme(themeMode || ThemeMode.light), {
274
- palette: overrideThemeByMode || {}
275
- })
276
- );
277
- }, [themeMode, overrideTheme]);
265
+ const theme = useMemo(
266
+ () => createTheme(getTheme(themeMode || ThemeMode.light)),
267
+ [themeMode]
268
+ );
278
269
 
279
270
  return (
280
271
  <StyledEngineProvider injectFirst enableCssLayer>
@@ -25,7 +25,7 @@
25
25
  /* =============
26
26
  COLOR SYSTEM
27
27
  ============= */
28
-
28
+
29
29
  /* Action colors */
30
30
  --color-action-acknowledged: #745f35;
31
31
  --color-action-acknowledged-background: #dfd2b9;
@@ -43,7 +43,7 @@
43
43
  --color-action-in-downtime-background: #e5d8f3;
44
44
  --color-action-selected: rgba(102, 102, 102, 0.3);
45
45
  --color-action-selected-opacity: 0.3;
46
-
46
+
47
47
  /* Background colors */
48
48
  --color-background-default: #f4f4f4;
49
49
  --color-background-listing-header: #666666;
@@ -52,18 +52,18 @@
52
52
  --color-background-paper: #ffffff;
53
53
  --color-background-tooltip: #434e58;
54
54
  --color-background-widget: #f8f8f8;
55
-
55
+
56
56
  /* Chip colors */
57
57
  --color-chip-error: #ff6666;
58
58
  --color-chip-info: #1588d1;
59
59
  --color-chip-neutral: #6da4e4;
60
60
  --color-chip-success: #88b922;
61
61
  --color-chip-warning: #fd9b27;
62
-
62
+
63
63
  /* Utility colors */
64
64
  --color-divider: #e3e3e3;
65
65
  --color-error-main: #ff4a4a;
66
-
66
+
67
67
  /* Header colors */
68
68
  --color-header-page-action-background-active: #1975d10f;
69
69
  --color-header-page-action-background-default: #ffffff00;
@@ -90,10 +90,10 @@
90
90
  --color-header-menu-item-color-active: #3e85d5;
91
91
  --color-header-menu-item-color-default: #1b2127;
92
92
  --color-header-menu-item-color-hover: #101418;
93
-
93
+
94
94
  /* State colors */
95
95
  --color-pending-main: #1ebeb3;
96
-
96
+
97
97
  /* Primary & Secondary colors */
98
98
  --color-primary-main: #2e68aa;
99
99
  --color-primary-light: #cde7fc;
@@ -101,7 +101,7 @@
101
101
  --color-secondary-main: #c772d6;
102
102
  --color-secondary-light: #e5a5f0;
103
103
  --color-secondary-dark: #ac28c1;
104
-
104
+
105
105
  /* Status colors */
106
106
  --color-status-background-error: #ff6666;
107
107
  --color-status-background-none: --alpha(#2e68aa / 10%);
@@ -110,7 +110,7 @@
110
110
  --color-stauts-background-unknown: #e3e3e3;
111
111
  --color-status-background-warning: #fd9b27;
112
112
  --color-success-main: #88b922;
113
-
113
+
114
114
  /* Text colors */
115
115
  --color-text-disabled: #999999;
116
116
  --color-text-primary: #000000;
@@ -118,7 +118,7 @@
118
118
  --color-warning-main: #fd9b27;
119
119
  --color-warning-light: #fcc481;
120
120
  --color-warning-dark: #fc7e00;
121
-
121
+
122
122
  /* Base colors */
123
123
  --color-white: #ffffff;
124
124
  --color-black: #000000;
@@ -8,6 +8,7 @@ import { SelectEntry, SingleConnectedAutocompleteField } from '../../../..';
8
8
  import RoleSelectField from '../common/RoleSelectField';
9
9
  import { Endpoints, Labels } from '../models';
10
10
 
11
+ import { ReactElement } from 'react';
11
12
  import ContactSwitch from './ContactSwitch';
12
13
  import { useShareInputStyles } from './ShareInput.styles';
13
14
  import useShareInput from './useShareInput';
@@ -18,18 +19,18 @@ interface Props {
18
19
  roles: Array<SelectEntry>;
19
20
  }
20
21
 
21
- const ShareInput = ({ labels, endpoints, roles }: Props): JSX.Element => {
22
+ const ShareInput = ({ labels, endpoints, roles }: Props): ReactElement => {
22
23
  const { t } = useTranslation();
23
24
  const { classes } = useShareInputStyles();
24
25
 
25
26
  const {
26
- renderOption,
27
27
  selectedContact,
28
28
  getOptionDisabled,
29
29
  getEndpoint,
30
30
  selectContact,
31
31
  isContactGroup,
32
32
  selectedRole,
33
+ getRenderedOptionText,
33
34
  setSelectedRole,
34
35
  add,
35
36
  changeIdValue
@@ -46,6 +47,7 @@ const ShareInput = ({ labels, endpoints, roles }: Props): JSX.Element => {
46
47
  disableClearable={false}
47
48
  field="name"
48
49
  getEndpoint={getEndpoint}
50
+ getRenderedOptionText={getRenderedOptionText}
49
51
  getOptionDisabled={getOptionDisabled}
50
52
  label={t(
51
53
  isContactGroup
@@ -53,7 +55,6 @@ const ShareInput = ({ labels, endpoints, roles }: Props): JSX.Element => {
53
55
  : t(labels.autocompleteContact)
54
56
  )}
55
57
  queryKey={isContactGroup ? labels.contactGroup : labels.contact}
56
- renderOption={renderOption}
57
58
  value={selectedContact}
58
59
  onChange={selectContact}
59
60
  />
@@ -1,10 +1,15 @@
1
- import { Dispatch, SetStateAction, useEffect, useState } from 'react';
1
+ import {
2
+ Dispatch,
3
+ ReactElement,
4
+ SetStateAction,
5
+ useEffect,
6
+ useState
7
+ } from 'react';
2
8
 
3
9
  import { useAtomValue, useSetAtom } from 'jotai';
4
10
  import { equals, includes, isNil } from 'ramda';
5
11
 
6
12
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
7
- import { ListItemText, MenuItem } from '@mui/material';
8
13
 
9
14
  import { SelectEntry, buildListingEndpoint } from '../../../..';
10
15
  import {
@@ -20,7 +25,7 @@ interface UseShareInputState {
20
25
  getEndpoint: (parameters) => string;
21
26
  getOptionDisabled: (option) => boolean;
22
27
  isContactGroup: boolean;
23
- renderOption: (attr, option) => JSX.Element;
28
+ getRenderedOptionText: (option: unknown) => ReactElement | string;
24
29
  selectContact: (_, entry) => void;
25
30
  selectedContact: AccessRightInitialValues | null;
26
31
  selectedRole: string;
@@ -40,7 +45,7 @@ const useShareInput = (endpoints: Endpoints): UseShareInputState => {
40
45
 
41
46
  const selectContact = (_, entry): void => {
42
47
  setSelectedContact(entry);
43
- if (equals('editor', entry.most_permissive_role)) {
48
+ if (equals('editor', entry?.most_permissive_role)) {
44
49
  return;
45
50
  }
46
51
  setSelectedRole('viewer');
@@ -71,14 +76,14 @@ const useShareInput = (endpoints: Endpoints): UseShareInputState => {
71
76
  }
72
77
  });
73
78
 
74
- const renderOption = (attr, option): JSX.Element => {
79
+ const getRenderedOptionText = (option): ReactElement => {
75
80
  return (
76
- <MenuItem {...attr}>
77
- <ListItemText>{option.name}</ListItemText>
78
- {includes(option.id, accessRightIds) && (
81
+ <>
82
+ {option?.name}
83
+ {includes(option?.id, accessRightIds) && (
79
84
  <CheckCircleIcon color="success" />
80
85
  )}
81
- </MenuItem>
86
+ </>
82
87
  );
83
88
  };
84
89
 
@@ -102,7 +107,7 @@ const useShareInput = (endpoints: Endpoints): UseShareInputState => {
102
107
  getEndpoint,
103
108
  getOptionDisabled,
104
109
  isContactGroup,
105
- renderOption,
110
+ getRenderedOptionText,
106
111
  selectContact,
107
112
  selectedContact,
108
113
  selectedRole,
@@ -5,13 +5,12 @@ import {
5
5
  Menu as MenuIcon
6
6
  } from '@mui/icons-material';
7
7
 
8
+ import { useStyles } from './MenuButton.styles';
8
9
  import { AriaLabelingAttributes } from '../../../@types/aria-attributes';
9
10
  import { DataTestAttributes } from '../../../@types/data-attributes';
10
11
  import { Button, ButtonProps } from '../../Button';
11
12
  import { useMenu } from '../useMenu';
12
13
 
13
- import { useStyles } from './MenuButton.styles';
14
-
15
14
  type MenuButtonProps = {
16
15
  ariaLabel?: string;
17
16
  children?: ReactNode;
@@ -72,7 +72,8 @@ const useStyles = makeStyles<{
72
72
  opacity: 0.6
73
73
  },
74
74
  top: theme.spacing(1)
75
- }
75
+ },
76
+
76
77
  }));
77
78
 
78
79
  export { useStyles };
@@ -16,11 +16,7 @@ const ModalHeader = ({
16
16
  }: ModalHeaderProps & DialogTitleProps): ReactElement => {
17
17
  return (
18
18
  <div className={modalHeader}>
19
- <MuiDialogTitle
20
- className="p-0 font-bold text-2xl"
21
- color="primary"
22
- {...rest}
23
- >
19
+ <MuiDialogTitle className="p-0 font-bold text-2xl" color="primary" {...rest}>
24
20
  {children}
25
21
  </MuiDialogTitle>
26
22
  </div>
@@ -1,74 +0,0 @@
1
- {
2
- "global": {},
3
- "metrics": [
4
- {
5
- "metric": "count",
6
- "metric_id": 1,
7
- "legend": "count",
8
- "displayAs": "bar",
9
- "ds_data": {
10
- "ds_stack": true,
11
- "ds_transparency": 0,
12
- "ds_filled": false,
13
- "ds_color_area": "#4269d0",
14
- "ds_color_line": "#4269d0"
15
- },
16
- "datasourceOptions": {
17
- "field": null,
18
- "group_by": null,
19
- "op": "count-doc",
20
- "query": "severity_text:\"Fatal\" OR severity_text:\"Error\"",
21
- "period": 3600
22
- },
23
- "data": [
24
- 217, 270, 293, 300, 303, 295, 298, 283, 299, 299, 297, 285, 270, 248,
25
- 274, 292, 284, 47
26
- ]
27
- },
28
- {
29
- "metric": "count",
30
- "metric_id": 2,
31
- "legend": "count",
32
- "displayAs": "bar",
33
- "ds_data": {
34
- "ds_stack": true,
35
- "ds_transparency": 0,
36
- "ds_filled": false,
37
- "ds_color_area": "#efb118",
38
- "ds_color_line": "#efb118"
39
- },
40
- "datasourceOptions": {
41
- "field": null,
42
- "group_by": null,
43
- "op": "count-doc",
44
- "query": "",
45
- "period": 3600
46
- },
47
- "data": [
48
- 32, 825, 939, 922, 918, 939, 943, 947, 946, 909, 931, 939, 883, 907,
49
- 928, 904, 923, 893, 139
50
- ]
51
- }
52
- ],
53
- "times": [
54
- "2025-10-04T16:19:30.000Z",
55
- "2025-10-04T16:20:00.000Z",
56
- "2025-10-04T16:20:30.000Z",
57
- "2025-10-04T16:21:00.000Z",
58
- "2025-10-04T16:21:30.000Z",
59
- "2025-10-04T16:22:00.000Z",
60
- "2025-10-04T16:22:30.000Z",
61
- "2025-10-04T16:23:00.000Z",
62
- "2025-10-04T16:23:30.000Z",
63
- "2025-10-04T16:24:00.000Z",
64
- "2025-10-04T16:24:30.000Z",
65
- "2025-10-04T16:25:00.000Z",
66
- "2025-10-04T16:25:30.000Z",
67
- "2025-10-04T16:26:00.000Z",
68
- "2025-10-04T16:26:30.000Z",
69
- "2025-10-04T16:27:00.000Z",
70
- "2025-10-04T16:27:30.000Z",
71
- "2025-10-04T16:28:00.000Z",
72
- "2025-10-04T16:28:30.000Z"
73
- ]
74
- }