@centreon/ui 26.3.7 → 26.3.9

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": "26.3.7",
3
+ "version": "26.3.9",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -5,6 +5,8 @@ import 'dayjs/locale/es';
5
5
  import 'dayjs/locale/fr';
6
6
  import 'dayjs/locale/pt';
7
7
 
8
+ import { NoData } from '@centreon/ui';
9
+
8
10
  import localizedFormat from 'dayjs/plugin/localizedFormat';
9
11
  import timezonePlugin from 'dayjs/plugin/timezone';
10
12
  import utcPlugin from 'dayjs/plugin/utc';
@@ -81,7 +83,6 @@ const WrapperChart = ({
81
83
  ...rest
82
84
  }: Props): JSX.Element | null => {
83
85
  const { classes, cx } = useChartStyles();
84
-
85
86
  const { adjustedData } = useChartData({ data, end, start });
86
87
 
87
88
  const containerRef = useRef<HTMLDivElement | null>(null);
@@ -112,7 +113,7 @@ const WrapperChart = ({
112
113
  }
113
114
 
114
115
  if (!adjustedData) {
115
- return <div />;
116
+ return <NoData />;
116
117
  }
117
118
 
118
119
  return (
@@ -7,3 +7,4 @@ export const labelDowntime = 'Downtime';
7
7
  export const labelMin = 'Min';
8
8
  export const labelMax = 'Max';
9
9
  export const labelAvg = 'Avg';
10
+ export const labelNoDataForThisPeriod = 'No data available for this period';
@@ -73,7 +73,7 @@ const Axes = ({
73
73
  tickFormat={formatAxisTick}
74
74
  tickLabelProps={() => ({
75
75
  ...axisLeft.tickLabelProps(),
76
- dx: isHorizontal ? 16 : -4
76
+ dx: data?.axisX?.dx ?? (isHorizontal ? 16 : -4)
77
77
  })}
78
78
  top={isHorizontal ? height - margin.bottom : 0}
79
79
  />
@@ -18,6 +18,7 @@ export interface AxisYRight extends Axis {
18
18
 
19
19
  export interface AxisX {
20
20
  xAxisTickFormat?: string;
21
+ dx?: number;
21
22
  }
22
23
  export interface Data
23
24
  extends Omit<ChartAxis, 'axisX' | 'axisYLeft' | 'axisYRight'> {
@@ -0,0 +1,18 @@
1
+ import { Typography } from '@mui/material';
2
+
3
+ import { useTranslation } from 'react-i18next';
4
+
5
+ import { labelNoDataForThisPeriod } from '../../Chart/translatedLabels';
6
+
7
+ const NoData = () => {
8
+ const { t } = useTranslation();
9
+ return (
10
+ <div className={'flex items-center justify-center h-full'}>
11
+ <Typography align="center" variant="body1">
12
+ {t(labelNoDataForThisPeriod)}
13
+ </Typography>
14
+ </div>
15
+ );
16
+ };
17
+
18
+ export default NoData;
@@ -7,6 +7,7 @@ export { default as ThresholdLines } from './Chart/BasicComponents/Lines/Thresho
7
7
  export * from './Chart/models';
8
8
  export { default as useLineChartData } from './Chart/useChartData';
9
9
  export { default as Header } from './common/BaseChart/Header';
10
+ export { default as NoData } from './common/Error/NoData';
10
11
  export type { LineChartData, Threshold, Thresholds } from './common/models';
11
12
  export * from './common/timeSeries';
12
13
  export type { Metric } from './common/timeSeries/models';