@centreon/ui 24.4.1-MON-38194-widgets-display-optimizations.1 → 24.4.1-MON-38194-widgets-display-optimizations.2
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.1-MON-38194-widgets-display-optimizations.
|
|
3
|
+
"version": "24.4.1-MON-38194-widgets-display-optimizations.2",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update:deps": "pnpx npm-check-updates -i --format group",
|
|
@@ -6,7 +6,7 @@ interface MakeStylesProps {
|
|
|
6
6
|
limitLegendRows?: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const legendWidth =
|
|
9
|
+
export const legendWidth = 25;
|
|
10
10
|
const legendItemHeight = 5.25;
|
|
11
11
|
const legendItemHeightCompact = 2;
|
|
12
12
|
|
|
@@ -62,12 +62,6 @@ interface StylesProps {
|
|
|
62
62
|
|
|
63
63
|
export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
64
64
|
(theme, { color }) => ({
|
|
65
|
-
container: {
|
|
66
|
-
display: 'flex',
|
|
67
|
-
flexDirection: 'row',
|
|
68
|
-
gap: theme.spacing(0.5),
|
|
69
|
-
width: '100%'
|
|
70
|
-
},
|
|
71
65
|
disabled: {
|
|
72
66
|
color: theme.palette.text.disabled
|
|
73
67
|
},
|
|
@@ -78,12 +72,6 @@ export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
|
78
72
|
minWidth: theme.spacing(1.5),
|
|
79
73
|
width: theme.spacing(1.5)
|
|
80
74
|
},
|
|
81
|
-
legendName: {
|
|
82
|
-
'&[data-mode="compact"]': {
|
|
83
|
-
maxWidth: theme.spacing(legendWidth * 0.5)
|
|
84
|
-
},
|
|
85
|
-
maxWidth: theme.spacing(legendWidth * 0.75)
|
|
86
|
-
},
|
|
87
75
|
markerAndLegendName: {
|
|
88
76
|
alignItems: 'center',
|
|
89
77
|
display: 'flex',
|
|
@@ -97,7 +85,7 @@ export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
|
97
85
|
whiteSpace: 'nowrap'
|
|
98
86
|
},
|
|
99
87
|
text: {
|
|
100
|
-
fontWeight: theme.typography.
|
|
88
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
101
89
|
lineHeight: 1
|
|
102
90
|
}
|
|
103
91
|
})
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { isEmpty } from 'ramda';
|
|
2
|
-
|
|
3
1
|
import { Typography } from '@mui/material';
|
|
4
2
|
|
|
5
3
|
import {
|
|
@@ -36,60 +34,47 @@ const LegendHeader = ({
|
|
|
36
34
|
const metricName = formatMetricName({ legend, name });
|
|
37
35
|
|
|
38
36
|
const legendName = legend || name;
|
|
39
|
-
const hasUnit = !isEmpty(unit);
|
|
40
37
|
const unitName = `(${unit})`;
|
|
41
38
|
|
|
42
|
-
const getEndText = (): string => {
|
|
43
|
-
if (value) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return hasUnit ? ` ${unitName}` : '';
|
|
48
|
-
};
|
|
49
|
-
|
|
50
39
|
return (
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
))}
|
|
69
|
-
</div>
|
|
40
|
+
<Tooltip
|
|
41
|
+
followCursor={false}
|
|
42
|
+
label={
|
|
43
|
+
minMaxAvg ? (
|
|
44
|
+
<div>
|
|
45
|
+
<Typography>{`${legendName} ${unitName}`}</Typography>
|
|
46
|
+
<div className={classes.minMaxAvgContainer}>
|
|
47
|
+
{minMaxAvg.map(({ label, value: subValue }) => (
|
|
48
|
+
<LegendContent
|
|
49
|
+
data={formatMetricValue({
|
|
50
|
+
unit: line.unit,
|
|
51
|
+
value: subValue
|
|
52
|
+
})}
|
|
53
|
+
key={label}
|
|
54
|
+
label={label}
|
|
55
|
+
/>
|
|
56
|
+
))}
|
|
70
57
|
</div>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
)}
|
|
92
|
-
</div>
|
|
58
|
+
</div>
|
|
59
|
+
) : (
|
|
60
|
+
`${legendName} ${unitName}`
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
placement="top"
|
|
64
|
+
>
|
|
65
|
+
<div className={classes.markerAndLegendName}>
|
|
66
|
+
<div className={cx(classes.icon, { [classes.disabled]: disabled })} />
|
|
67
|
+
<EllipsisTypography
|
|
68
|
+
className={classes.text}
|
|
69
|
+
data-mode={
|
|
70
|
+
value ? LegendDisplayMode.Compact : LegendDisplayMode.Normal
|
|
71
|
+
}
|
|
72
|
+
variant="body2"
|
|
73
|
+
>
|
|
74
|
+
{metricName}
|
|
75
|
+
</EllipsisTypography>
|
|
76
|
+
</div>
|
|
77
|
+
</Tooltip>
|
|
93
78
|
);
|
|
94
79
|
};
|
|
95
80
|
|