@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,22 +1,23 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
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:
|
|
56
|
-
sortOrder:
|
|
56
|
+
mode: "all",
|
|
57
|
+
sortOrder: "name",
|
|
57
58
|
},
|
|
58
59
|
annotationEvent,
|
|
59
60
|
legend = {
|
|
60
61
|
display: true,
|
|
61
|
-
mode:
|
|
62
|
-
placement:
|
|
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 ||
|
|
110
|
+
<Loading height={height || "100%"} width={width} />
|
|
107
111
|
) : (
|
|
108
112
|
<Chart
|
|
109
113
|
annotationEvent={annotationEvent}
|
|
@@ -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;
|
package/src/Graph/index.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export type { ParentSizeProps } from
|
|
2
|
-
export { default as
|
|
3
|
-
export {
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export { default as
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export * from
|
|
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";
|