@centreon/ui 25.6.10 → 25.6.12
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 +1 -1
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +1 -3
- package/src/Graph/Text/Text.styles.ts +3 -6
- package/src/Graph/Text/Text.tsx +18 -7
- package/src/Graph/index.ts +1 -1
- package/src/ThemeProvider/palettes.ts +3 -1
- package/src/ThemeProvider/tailwindcss.css +2 -0
- package/src/components/Tabs/Tabs.tsx +1 -1
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { animated, useSpring } from '@react-spring/web';
|
|
|
4
4
|
import { scaleLinear } from '@visx/scale';
|
|
5
5
|
import { Bar } from '@visx/shape';
|
|
6
6
|
import { Group, Tooltip } from '@visx/visx';
|
|
7
|
-
import { clamp, equals, flatten, head,
|
|
7
|
+
import { clamp, equals, flatten, head, pluck } from 'ramda';
|
|
8
8
|
|
|
9
9
|
import { Box, alpha, useTheme } from '@mui/material';
|
|
10
10
|
|
|
@@ -41,8 +41,6 @@ const ResponsiveSingleBar = ({
|
|
|
41
41
|
const { classes } = useTooltipStyles();
|
|
42
42
|
const theme = useTheme();
|
|
43
43
|
|
|
44
|
-
const isSmallHeight = lt(height, 150);
|
|
45
|
-
|
|
46
44
|
const metric = getMetricWithLatestData(data) as Metric;
|
|
47
45
|
const latestMetricData = head(metric.data) as number;
|
|
48
46
|
const thresholdValues = thresholds.enabled
|
|
@@ -11,16 +11,13 @@ export const useTextStyles = makeStyles()((theme) => ({
|
|
|
11
11
|
gap: theme.spacing(1),
|
|
12
12
|
justifyContent: 'center'
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
textAlign: '
|
|
16
|
-
},
|
|
17
|
-
thresholdLeft: {
|
|
18
|
-
textAlign: 'end'
|
|
14
|
+
thresholdLabel: {
|
|
15
|
+
textAlign: 'center'
|
|
19
16
|
},
|
|
20
17
|
thresholds: {
|
|
21
18
|
display: 'flex',
|
|
22
19
|
flexDirection: 'row',
|
|
23
|
-
gap: theme.spacing(
|
|
20
|
+
gap: theme.spacing(1),
|
|
24
21
|
whiteSpace: 'nowrap',
|
|
25
22
|
width: '100%'
|
|
26
23
|
},
|
package/src/Graph/Text/Text.tsx
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from '../common/timeSeries';
|
|
11
11
|
import { getColorFromDataAndTresholds } from '../common/utils';
|
|
12
12
|
|
|
13
|
+
import { type ReactElement } from 'react';
|
|
14
|
+
import useResizeObserver from 'use-resize-observer';
|
|
13
15
|
import { useTextStyles } from './Text.styles';
|
|
14
16
|
|
|
15
17
|
export interface Props {
|
|
@@ -22,6 +24,7 @@ export interface Props {
|
|
|
22
24
|
};
|
|
23
25
|
thresholds: Thresholds;
|
|
24
26
|
prefThresholds?: number;
|
|
27
|
+
minThresholds?: string;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export const Text = ({
|
|
@@ -30,10 +33,12 @@ export const Text = ({
|
|
|
30
33
|
displayAsRaw,
|
|
31
34
|
labels,
|
|
32
35
|
baseColor,
|
|
33
|
-
prefThresholds = 14
|
|
34
|
-
|
|
36
|
+
prefThresholds = 14,
|
|
37
|
+
minThresholds
|
|
38
|
+
}: Props): ReactElement | null => {
|
|
35
39
|
const theme = useTheme();
|
|
36
40
|
const { classes, cx } = useTextStyles();
|
|
41
|
+
const { ref, width = 0 } = useResizeObserver();
|
|
37
42
|
|
|
38
43
|
if (isNil(data)) {
|
|
39
44
|
return null;
|
|
@@ -64,8 +69,12 @@ export const Text = ({
|
|
|
64
69
|
})
|
|
65
70
|
);
|
|
66
71
|
|
|
72
|
+
const canDisplayThresholdLabel = width > 150;
|
|
73
|
+
const warningLabel = canDisplayThresholdLabel ? `${labels.warning}: ` : '';
|
|
74
|
+
const criticalLabel = canDisplayThresholdLabel ? `${labels.critical}: ` : '';
|
|
75
|
+
|
|
67
76
|
return (
|
|
68
|
-
<div className={classes.graphText}>
|
|
77
|
+
<div className={classes.graphText} ref={ref}>
|
|
69
78
|
<FluidTypography
|
|
70
79
|
max="40px"
|
|
71
80
|
pref={14}
|
|
@@ -82,18 +91,20 @@ export const Text = ({
|
|
|
82
91
|
{thresholds.enabled && (
|
|
83
92
|
<div className={classes.thresholds}>
|
|
84
93
|
<FluidTypography
|
|
85
|
-
containerClassName={cx(classes.
|
|
94
|
+
containerClassName={cx(classes.thresholdLabel, classes.warning)}
|
|
86
95
|
max="30px"
|
|
87
96
|
pref={prefThresholds}
|
|
88
|
-
text={`${
|
|
97
|
+
text={`${warningLabel}${warningThresholdLabels.join(' - ')}`}
|
|
89
98
|
variant="h5"
|
|
99
|
+
min={minThresholds}
|
|
90
100
|
/>
|
|
91
101
|
<FluidTypography
|
|
92
|
-
containerClassName={cx(classes.
|
|
102
|
+
containerClassName={cx(classes.thresholdLabel, classes.critical)}
|
|
93
103
|
max="30px"
|
|
94
104
|
pref={prefThresholds}
|
|
95
|
-
text={`${
|
|
105
|
+
text={`${criticalLabel}${criticalThresholdLabels.join(' - ')}`}
|
|
96
106
|
variant="h5"
|
|
107
|
+
min={minThresholds}
|
|
97
108
|
/>
|
|
98
109
|
</div>
|
|
99
110
|
)}
|
package/src/Graph/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { BarStack } from './BarStack';
|
|
|
12
12
|
export { PieChart } from './PieChart';
|
|
13
13
|
export { Timeline } from './Timeline';
|
|
14
14
|
export * from './Tree';
|
|
15
|
-
export type { LineChartData } from './common/models';
|
|
15
|
+
export type { LineChartData, Threshold, Thresholds } from './common/models';
|
|
16
16
|
export * from './common/timeSeries';
|
|
17
17
|
export type { Metric } from './common/timeSeries/models';
|
|
18
18
|
export * from './Chart/models';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { TabContext } from '@mui/lab';
|
|
4
|
-
import {
|
|
4
|
+
import { Tabs as MuiTabs, Tab, TabsProps } from '@mui/material';
|
|
5
5
|
|
|
6
6
|
import { useTabsStyles } from './Tab.styles';
|
|
7
7
|
|