@centreon/ui 25.10.10 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.10.10",
3
+ "version": "25.10.11",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -1,22 +1,23 @@
1
- import { RefCallback, memo, useEffect } from 'react';
1
+ import dayjs from "dayjs";
2
+ import { memo, type RefCallback, useEffect } from "react";
3
+ import "dayjs/locale/en";
4
+ import "dayjs/locale/es";
5
+ import "dayjs/locale/fr";
6
+ import "dayjs/locale/pt";
2
7
 
3
- import dayjs from 'dayjs';
4
- import 'dayjs/locale/en';
5
- import 'dayjs/locale/es';
6
- import 'dayjs/locale/fr';
7
- import 'dayjs/locale/pt';
8
- import localizedFormat from 'dayjs/plugin/localizedFormat';
9
- import timezonePlugin from 'dayjs/plugin/timezone';
10
- import utcPlugin from 'dayjs/plugin/utc';
11
- import Loading from '../../LoadingSkeleton';
12
- import type { LineChartData, Thresholds } from '../common/models';
8
+ import { NoData } from "@centreon/ui";
13
9
 
14
- import useResizeObserver from 'use-resize-observer';
15
- import Chart from './Chart';
16
- import { useChartStyles } from './Chart.styles';
17
- import LoadingSkeleton from './LoadingSkeleton';
18
- import type { GlobalAreaLines, LineChartProps } from './models';
19
- import useChartData from './useChartData';
10
+ import localizedFormat from "dayjs/plugin/localizedFormat";
11
+ import timezonePlugin from "dayjs/plugin/timezone";
12
+ import utcPlugin from "dayjs/plugin/utc";
13
+ import useResizeObserver from "use-resize-observer";
14
+ import Loading from "../../LoadingSkeleton";
15
+ import type { LineChartData, Thresholds } from "../common/models";
16
+ import Chart from "./Chart";
17
+ import { useChartStyles } from "./Chart.styles";
18
+ import LoadingSkeleton from "./LoadingSkeleton";
19
+ import type { GlobalAreaLines, LineChartProps } from "./models";
20
+ import useChartData from "./useChartData";
20
21
 
21
22
  dayjs.extend(localizedFormat);
22
23
  dayjs.extend(utcPlugin);
@@ -52,14 +53,14 @@ const WrapperChart = ({
52
53
  loading,
53
54
  timeShiftZones,
54
55
  tooltip = {
55
- mode: 'all',
56
- sortOrder: 'name'
56
+ mode: "all",
57
+ sortOrder: "name",
57
58
  },
58
59
  annotationEvent,
59
60
  legend = {
60
61
  display: true,
61
- mode: 'grid',
62
- placement: 'bottom'
62
+ mode: "grid",
63
+ placement: "bottom",
63
64
  },
64
65
  header,
65
66
  lineStyle,
@@ -76,12 +77,11 @@ const WrapperChart = ({
76
77
  ...rest
77
78
  }: Props): JSX.Element | null => {
78
79
  const { classes, cx } = useChartStyles();
79
-
80
80
  const { adjustedData } = useChartData({ data, end, start });
81
81
  const {
82
82
  ref,
83
83
  width: responsiveWidth,
84
- height: responsiveHeight
84
+ height: responsiveHeight,
85
85
  } = useResizeObserver();
86
86
 
87
87
  useEffect(() => {
@@ -97,13 +97,17 @@ const WrapperChart = ({
97
97
  );
98
98
  }
99
99
 
100
+ if (!adjustedData) {
101
+ return <NoData />;
102
+ }
103
+
100
104
  return (
101
105
  <div
102
106
  ref={ref}
103
107
  className={cx(classes.wrapperContainer, rest?.containerStyle)}
104
108
  >
105
109
  {!responsiveHeight ? (
106
- <Loading height={height || '100%'} width={width} />
110
+ <Loading height={height || "100%"} width={width} />
107
111
  ) : (
108
112
  <Chart
109
113
  annotationEvent={annotationEvent}
@@ -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';
@@ -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;
@@ -1,20 +1,20 @@
1
- export type { ParentSizeProps } from '@visx/responsive/lib/components/ParentSize';
2
- export { default as LineChart } from './Chart';
3
- export { default as ThresholdLines } from './Chart/BasicComponents/Lines/Threshold';
4
- export { default as useLineChartData } from './Chart/useChartData';
5
- export { default as BarChart } from './BarChart/BarChart';
6
- export { Gauge } from './Gauge';
7
- export { SingleBar } from './SingleBar';
8
- export { Text as GraphText } from './Text';
9
- export { default as Header } from './common/BaseChart/Header';
10
-
11
- export { HeatMap } from './HeatMap';
12
- export { BarStack } from './BarStack';
13
- export { PieChart } from './PieChart';
14
- export { Timeline } from './Timeline';
15
- export * from './Tree';
16
- export type { LineChartData, Threshold, Thresholds } from './common/models';
17
- export * from './common/timeSeries';
18
- export type { Metric } from './common/timeSeries/models';
19
- export * from './Chart/models';
20
- export * from './PieChart/models';
1
+ export type { ParentSizeProps } from "@visx/responsive/lib/components/ParentSize";
2
+ export { default as BarChart } from "./BarChart/BarChart";
3
+ export { BarStack } from "./BarStack";
4
+ export { default as LineChart } from "./Chart";
5
+ export { default as ThresholdLines } from "./Chart/BasicComponents/Lines/Threshold";
6
+ export * from "./Chart/models";
7
+ export { default as useLineChartData } from "./Chart/useChartData";
8
+ export { default as Header } from "./common/BaseChart/Header";
9
+ export { default as NoData } from "./common/Error/NoData";
10
+ export type { LineChartData, Threshold, Thresholds } from "./common/models";
11
+ export * from "./common/timeSeries";
12
+ export type { Metric } from "./common/timeSeries/models";
13
+ export { Gauge } from "./Gauge";
14
+ export { HeatMap } from "./HeatMap";
15
+ export { PieChart } from "./PieChart";
16
+ export * from "./PieChart/models";
17
+ export { SingleBar } from "./SingleBar";
18
+ export { Text as GraphText } from "./Text";
19
+ export { Timeline } from "./Timeline";
20
+ export * from "./Tree";