@centreon/ui 24.4.61 → 24.4.63

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": "24.4.61",
3
+ "version": "24.4.63",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -10,13 +10,6 @@ const defaultData = [
10
10
  { color: '#FF6666', label: 'Down', value: 62 }
11
11
  ];
12
12
 
13
- const dataWithNullValues = [
14
- { color: '#88B922', label: 'Ok', value: 0 },
15
- { color: '#999999', label: 'Unknown', value: 0 },
16
- { color: '#F7931A', label: 'Warning', value: 0 },
17
- { color: '#FF6666', label: 'Down', value: 0 }
18
- ];
19
-
20
13
  const total = Math.floor(
21
14
  defaultData.reduce((acc, { value }) => acc + value, 0)
22
15
  );
@@ -143,12 +136,4 @@ describe('Bar stack', () => {
143
136
 
144
137
  cy.makeSnapshot();
145
138
  });
146
-
147
- it('displays a message "No Data Available" when all values are null', () => {
148
- initialize({ data: dataWithNullValues, title: 'host' });
149
-
150
- cy.contains('No Data Available');
151
-
152
- cy.makeSnapshot();
153
- });
154
139
  });
@@ -7,13 +7,10 @@ import { Text } from '@visx/text';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { equals } from 'ramda';
9
9
 
10
- import { Typography } from '@mui/material';
11
-
12
10
  import { Tooltip } from '../../components';
13
11
  import { LegendProps } from '../Legend/models';
14
12
  import { Legend as LegendComponent } from '../Legend';
15
13
  import { getValueByUnit } from '../common/utils';
16
- import { labelNoDataFound as defaultlabelNoDataFound } from '../translatedLabels';
17
14
 
18
15
  import { BarStackProps } from './models';
19
16
  import { useBarStackStyles } from './BarStack.styles';
@@ -36,8 +33,7 @@ const BarStack = ({
36
33
  unit = 'number',
37
34
  displayValues,
38
35
  variant = 'vertical',
39
- legendDirection = 'column',
40
- labelNoDataFound = defaultlabelNoDataFound
36
+ legendDirection = 'column'
41
37
  }: BarStackProps & { height: number; width: number }): JSX.Element => {
42
38
  const { t } = useTranslation();
43
39
  const { classes } = useBarStackStyles();
@@ -56,8 +52,7 @@ const BarStack = ({
56
52
  yScale,
57
53
  svgWrapperWidth,
58
54
  svgContainerSize,
59
- isVerticalBar,
60
- areAllValuesNull
55
+ isVerticalBar
61
56
  } = useResponsiveBarStack({
62
57
  data,
63
58
  height,
@@ -73,14 +68,6 @@ const BarStack = ({
73
68
  ? BarStackVertical
74
69
  : BarStackHorizontal;
75
70
 
76
- if (areAllValuesNull) {
77
- return (
78
- <div className={classes.container} style={{ height, width }}>
79
- <Typography variant="h3">{t(labelNoDataFound)}</Typography>
80
- </div>
81
- );
82
- }
83
-
84
71
  return (
85
72
  <div className={classes.container} style={{ height, width }}>
86
73
  <div
@@ -10,7 +10,6 @@ export type BarStackProps = {
10
10
  data: Array<BarType>;
11
11
  displayLegend?: boolean;
12
12
  displayValues?: boolean;
13
- labelNoDataFound?: string;
14
13
  legendDirection?: 'row' | 'column';
15
14
  onSingleBarClick?: (barData) => void;
16
15
  size?: number;
@@ -1,5 +1,5 @@
1
1
  import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
2
- import { equals, isEmpty, pluck, reject } from 'ramda';
2
+ import { equals, pluck } from 'ramda';
3
3
 
4
4
  import { getValueByUnit } from '../common/utils';
5
5
  import { LegendScale } from '../Legend/models';
@@ -22,7 +22,6 @@ interface useBarStackProps {
22
22
  width: number;
23
23
  }
24
24
  interface useBarStackState {
25
- areAllValuesNull: boolean;
26
25
  barSize: Size;
27
26
  colorScale;
28
27
  input;
@@ -114,12 +113,7 @@ const useResponsiveBarStack = ({
114
113
  return acc;
115
114
  }, {});
116
115
 
117
- const values = pluck('value', data);
118
-
119
- const areAllValuesNull = isEmpty(reject((value) => equals(value, 0), values));
120
-
121
116
  return {
122
- areAllValuesNull,
123
117
  barSize,
124
118
  colorScale,
125
119
  input,
@@ -10,13 +10,6 @@ const defaultData = [
10
10
  { color: '#FF6666', label: 'Down', value: 62 }
11
11
  ];
12
12
 
13
- const dataWithNullValues = [
14
- { color: '#88B922', label: 'Ok', value: 0 },
15
- { color: '#999999', label: 'Unknown', value: 0 },
16
- { color: '#F7931A', label: 'Warning', value: 0 },
17
- { color: '#FF6666', label: 'Down', value: 0 }
18
- ];
19
-
20
13
  const total = Math.floor(
21
14
  defaultData.reduce((acc, { value }) => acc + value, 0)
22
15
  );
@@ -158,12 +151,4 @@ describe('Pie chart', () => {
158
151
 
159
152
  cy.makeSnapshot();
160
153
  });
161
-
162
- it('displays a message "No Data Available" when all values are null', () => {
163
- initialize({ data: dataWithNullValues, title: 'host' });
164
-
165
- cy.contains('No Data Available');
166
-
167
- cy.makeSnapshot();
168
- });
169
154
  });
@@ -7,13 +7,12 @@ import numeral from 'numeral';
7
7
  import { always, equals, gt, ifElse, lt } from 'ramda';
8
8
  import { useTranslation } from 'react-i18next';
9
9
 
10
- import { Typography, useTheme } from '@mui/material';
10
+ import { useTheme } from '@mui/material';
11
11
 
12
12
  import { Tooltip } from '../../components';
13
13
  import { Legend as LegendComponent } from '../Legend';
14
14
  import { LegendProps } from '../Legend/models';
15
15
  import { getValueByUnit } from '../common/utils';
16
- import { labelNoDataFound as defaultlabelNoDataFound } from '../translatedLabels';
17
16
 
18
17
  import { PieProps } from './models';
19
18
  import { usePieStyles } from './PieChart.styles';
@@ -54,8 +53,7 @@ const ResponsivePie = ({
54
53
  onArcClick,
55
54
  displayValues,
56
55
  TooltipContent,
57
- legendDirection = 'column',
58
- labelNoDataFound = defaultlabelNoDataFound
56
+ legendDirection = 'column'
59
57
  }: PieProps & { height: number; width: number }): JSX.Element => {
60
58
  const { t } = useTranslation();
61
59
  const theme = useTheme();
@@ -71,8 +69,7 @@ const ResponsivePie = ({
71
69
  svgWrapperWidth,
72
70
  total,
73
71
  innerRadius,
74
- isContainsExactlyOneNonZeroValue,
75
- areAllValuesNull
72
+ isContainsExactlyOneNonZeroValue
76
73
  } = useResponsivePie({
77
74
  data,
78
75
  defaultInnerRadius,
@@ -85,14 +82,6 @@ const ResponsivePie = ({
85
82
 
86
83
  const { classes } = usePieStyles({ svgSize });
87
84
 
88
- if (areAllValuesNull) {
89
- return (
90
- <div className={classes.container} style={{ height, width }}>
91
- <Typography variant="h3">{t(labelNoDataFound)}</Typography>
92
- </div>
93
- );
94
- }
95
-
96
85
  return (
97
86
  <div
98
87
  className={classes.container}
@@ -11,7 +11,6 @@ export interface PieProps {
11
11
  displayLegend?: boolean;
12
12
  displayValues?: boolean;
13
13
  innerRadius?: number;
14
- labelNoDataFound?: string;
15
14
  legendDirection?: 'row' | 'column';
16
15
  onArcClick?: (ardata) => void;
17
16
  title?: string;
@@ -1,4 +1,4 @@
1
- import { equals, isEmpty, pluck, reject } from 'ramda';
1
+ import { equals, pluck, reject } from 'ramda';
2
2
 
3
3
  import { LegendScale } from '../Legend/models';
4
4
  import { getValueByUnit } from '../common/utils';
@@ -16,7 +16,6 @@ interface ResponsivePieProps {
16
16
  }
17
17
 
18
18
  interface ResponsivePieState {
19
- areAllValuesNull: boolean;
20
19
  half: number;
21
20
  innerRadius: number;
22
21
  isContainsExactlyOneNonZeroValue: boolean;
@@ -69,10 +68,7 @@ export const useResponsivePie = ({
69
68
  1
70
69
  );
71
70
 
72
- const areAllValuesNull = isEmpty(reject((value) => equals(value, 0), values));
73
-
74
71
  return {
75
- areAllValuesNull,
76
72
  half,
77
73
  innerRadius,
78
74
  isContainsExactlyOneNonZeroValue,
@@ -184,6 +184,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
184
184
  padding: 0;
185
185
  width: 100%;
186
186
  }
187
+ #root {
188
+ background-color: ${theme.palette.background.paper};
189
+ }
187
190
  @font-face {
188
191
  font-family: 'Roboto';
189
192
  font-style: normal;
@@ -53,7 +53,7 @@ export const useFullscreen = (): UseFullscreenState => {
53
53
  };
54
54
 
55
55
  const toggleFullscreen = (element: HTMLElement | null): void => {
56
- if (isFullscreenActivated) {
56
+ if (isFullscreenActivated || document.fullscreenElement) {
57
57
  exitFullscreen();
58
58
 
59
59
  return;
@@ -1 +0,0 @@
1
- export const labelNoDataFound = 'No Data Available';