@centreon/ui 24.4.65 → 24.4.67
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/Dashboard/Dashboard.styles.ts +6 -5
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
- package/src/Graph/LineChart/InteractiveComponents/index.tsx +1 -2
- package/src/Graph/LineChart/Legend/Legend.styles.ts +4 -8
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +3 -18
- package/src/Graph/LineChart/LineChart.tsx +2 -13
- package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
- package/src/Graph/LineChart/index.tsx +2 -6
- package/src/Graph/LineChart/models.ts +0 -1
- package/src/Graph/Text/Text.styles.ts +12 -1
- package/src/Graph/Text/Text.tsx +16 -11
- package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
package/package.json
CHANGED
|
@@ -76,11 +76,12 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
|
76
76
|
border: 'none',
|
|
77
77
|
borderRadius: theme.spacing(1),
|
|
78
78
|
height: '100%',
|
|
79
|
-
paddingBottom: theme.spacing(2),
|
|
80
79
|
width: '100%'
|
|
81
80
|
},
|
|
82
81
|
widgetContent: {
|
|
83
|
-
height:
|
|
82
|
+
height: hasHeader
|
|
83
|
+
? `calc(100% - ${theme.spacing(3.5)} - ${theme.spacing(0.5)})`
|
|
84
|
+
: `calc(100% - ${theme.spacing(3.5)})`
|
|
84
85
|
},
|
|
85
86
|
widgetHeader: {
|
|
86
87
|
'&:hover': {
|
|
@@ -92,17 +93,17 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
|
92
93
|
'&[data-canMove="true"]': {
|
|
93
94
|
cursor: 'move'
|
|
94
95
|
},
|
|
95
|
-
padding: theme.spacing(0.5
|
|
96
|
+
padding: theme.spacing(0, 1.5),
|
|
96
97
|
position: 'relative'
|
|
97
98
|
},
|
|
98
99
|
widgetHeaderDraggable: {
|
|
99
100
|
height: '100%',
|
|
100
101
|
position: 'absolute',
|
|
101
|
-
width: '
|
|
102
|
+
width: '95%'
|
|
102
103
|
},
|
|
103
104
|
widgetPadding: {
|
|
104
105
|
overflowX: 'auto',
|
|
105
|
-
padding:
|
|
106
|
+
padding: theme.spacing(0.5, 1.5, 1.5)
|
|
106
107
|
}
|
|
107
108
|
})
|
|
108
109
|
);
|
|
@@ -2,6 +2,8 @@ import { equals } from 'ramda';
|
|
|
2
2
|
|
|
3
3
|
import { useTheme } from '@mui/material';
|
|
4
4
|
|
|
5
|
+
import { margin } from '../common';
|
|
6
|
+
|
|
5
7
|
interface Props {
|
|
6
8
|
hideTooltip: () => void;
|
|
7
9
|
label: string;
|
|
@@ -28,7 +30,7 @@ export const ThresholdLine = ({
|
|
|
28
30
|
const onMouseEnter = (): void =>
|
|
29
31
|
showTooltip({
|
|
30
32
|
tooltipData: label,
|
|
31
|
-
tooltipLeft:
|
|
33
|
+
tooltipLeft: -(margin.left + margin.right),
|
|
32
34
|
tooltipTop: scaledValue
|
|
33
35
|
});
|
|
34
36
|
|
|
@@ -70,7 +70,6 @@ interface CommonData {
|
|
|
70
70
|
|
|
71
71
|
interface TimeShiftZonesData extends InteractedZone {
|
|
72
72
|
graphInterval: GraphInterval;
|
|
73
|
-
loading: boolean;
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
interface Props {
|
|
@@ -234,7 +233,7 @@ const InteractionWithGraph = ({
|
|
|
234
233
|
value: timeValue?.[metric_id]
|
|
235
234
|
}),
|
|
236
235
|
linesData
|
|
237
|
-
).filter(({ value }) => value)
|
|
236
|
+
).filter(({ value }) => !isNil(value))
|
|
238
237
|
});
|
|
239
238
|
};
|
|
240
239
|
|
|
@@ -28,10 +28,11 @@ export const useStyles = makeStyles<MakeStylesProps>()(
|
|
|
28
28
|
columnGap: theme.spacing(3),
|
|
29
29
|
display: 'grid',
|
|
30
30
|
gridAutoRows: theme.spacing(legendItemHeight),
|
|
31
|
-
gridTemplateColumns: `repeat(auto-fit, ${theme.spacing(legendWidth)})`,
|
|
31
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(${theme.spacing(legendWidth)}, 1fr))`,
|
|
32
32
|
maxHeight: limitLegendRows
|
|
33
33
|
? theme.spacing(legendItemHeight * 2 + 1)
|
|
34
34
|
: 'unset',
|
|
35
|
+
overflowX: 'hidden',
|
|
35
36
|
overflowY: 'auto',
|
|
36
37
|
rowGap: theme.spacing(1),
|
|
37
38
|
width: '100%'
|
|
@@ -63,9 +64,6 @@ interface StylesProps {
|
|
|
63
64
|
export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
64
65
|
(theme, { color }) => ({
|
|
65
66
|
container: {
|
|
66
|
-
display: 'flex',
|
|
67
|
-
flexDirection: 'row',
|
|
68
|
-
gap: theme.spacing(0.5),
|
|
69
67
|
width: '100%'
|
|
70
68
|
},
|
|
71
69
|
disabled: {
|
|
@@ -79,10 +77,7 @@ export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
|
79
77
|
width: theme.spacing(1.5)
|
|
80
78
|
},
|
|
81
79
|
legendName: {
|
|
82
|
-
'
|
|
83
|
-
maxWidth: theme.spacing(legendWidth * 0.5)
|
|
84
|
-
},
|
|
85
|
-
maxWidth: theme.spacing(legendWidth * 0.75)
|
|
80
|
+
maxWidth: '95%'
|
|
86
81
|
},
|
|
87
82
|
markerAndLegendName: {
|
|
88
83
|
alignItems: 'center',
|
|
@@ -97,6 +92,7 @@ export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
|
97
92
|
whiteSpace: 'nowrap'
|
|
98
93
|
},
|
|
99
94
|
text: {
|
|
95
|
+
fontSize: '0.75rem',
|
|
100
96
|
fontWeight: theme.typography.fontWeightMedium,
|
|
101
97
|
lineHeight: 1
|
|
102
98
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { isEmpty } from 'ramda';
|
|
2
|
-
|
|
3
1
|
import { Typography } from '@mui/material';
|
|
4
2
|
|
|
5
3
|
import {
|
|
@@ -31,21 +29,11 @@ const LegendHeader = ({
|
|
|
31
29
|
}: Props): JSX.Element => {
|
|
32
30
|
const { classes, cx } = useLegendHeaderStyles({ color });
|
|
33
31
|
|
|
34
|
-
const {
|
|
32
|
+
const { name, legend } = line;
|
|
35
33
|
|
|
36
34
|
const metricName = formatMetricName({ legend, name });
|
|
37
35
|
|
|
38
36
|
const legendName = legend || name;
|
|
39
|
-
const hasUnit = !isEmpty(unit);
|
|
40
|
-
const unitName = `(${unit})`;
|
|
41
|
-
|
|
42
|
-
const getEndText = (): string => {
|
|
43
|
-
if (value) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return hasUnit ? ` ${unitName}` : '';
|
|
48
|
-
};
|
|
49
37
|
|
|
50
38
|
return (
|
|
51
39
|
<div className={classes.container}>
|
|
@@ -54,7 +42,7 @@ const LegendHeader = ({
|
|
|
54
42
|
label={
|
|
55
43
|
minMaxAvg ? (
|
|
56
44
|
<div>
|
|
57
|
-
<Typography>{
|
|
45
|
+
<Typography>{legendName}</Typography>
|
|
58
46
|
<div className={classes.minMaxAvgContainer}>
|
|
59
47
|
{minMaxAvg.map(({ label, value: subValue }) => (
|
|
60
48
|
<LegendContent
|
|
@@ -69,7 +57,7 @@ const LegendHeader = ({
|
|
|
69
57
|
</div>
|
|
70
58
|
</div>
|
|
71
59
|
) : (
|
|
72
|
-
|
|
60
|
+
legendName
|
|
73
61
|
)
|
|
74
62
|
}
|
|
75
63
|
placement="top"
|
|
@@ -86,9 +74,6 @@ const LegendHeader = ({
|
|
|
86
74
|
</EllipsisTypography>
|
|
87
75
|
</div>
|
|
88
76
|
</Tooltip>
|
|
89
|
-
{hasUnit && (
|
|
90
|
-
<Typography className={classes.text}>{getEndText()}</Typography>
|
|
91
|
-
)}
|
|
92
77
|
</div>
|
|
93
78
|
);
|
|
94
79
|
};
|
|
@@ -14,7 +14,6 @@ import Axes from './BasicComponents/Axes';
|
|
|
14
14
|
import Grids from './BasicComponents/Grids';
|
|
15
15
|
import Lines from './BasicComponents/Lines';
|
|
16
16
|
import { canDisplayThreshold } from './BasicComponents/Lines/Threshold/models';
|
|
17
|
-
import LoadingProgress from './BasicComponents/LoadingProgress';
|
|
18
17
|
import useFilterLines from './BasicComponents/useFilterLines';
|
|
19
18
|
import { useStyles } from './LineChart.styles';
|
|
20
19
|
import Header from './Header';
|
|
@@ -45,7 +44,6 @@ interface Props extends LineChartProps {
|
|
|
45
44
|
graphRef: MutableRefObject<HTMLDivElement | null>;
|
|
46
45
|
legend?: LegendModel;
|
|
47
46
|
limitLegend?: false | number;
|
|
48
|
-
marginBottom: number;
|
|
49
47
|
shapeLines?: GlobalAreaLines;
|
|
50
48
|
thresholdUnit?: string;
|
|
51
49
|
thresholds?: ThresholdsModel;
|
|
@@ -63,7 +61,6 @@ const LineChart = ({
|
|
|
63
61
|
shapeLines,
|
|
64
62
|
axis,
|
|
65
63
|
displayAnchor,
|
|
66
|
-
loading,
|
|
67
64
|
zoomPreview,
|
|
68
65
|
graphInterval,
|
|
69
66
|
timeShiftZones,
|
|
@@ -73,7 +70,6 @@ const LineChart = ({
|
|
|
73
70
|
graphRef,
|
|
74
71
|
header,
|
|
75
72
|
curve,
|
|
76
|
-
marginBottom,
|
|
77
73
|
thresholds,
|
|
78
74
|
thresholdUnit,
|
|
79
75
|
limitLegend
|
|
@@ -104,8 +100,7 @@ const LineChart = ({
|
|
|
104
100
|
(height || 0) > 0
|
|
105
101
|
? (height || 0) -
|
|
106
102
|
margin.top -
|
|
107
|
-
|
|
108
|
-
marginBottom -
|
|
103
|
+
5 -
|
|
109
104
|
(legendRef.current?.getBoundingClientRect().height || 0)
|
|
110
105
|
: 0;
|
|
111
106
|
|
|
@@ -196,11 +191,6 @@ const LineChart = ({
|
|
|
196
191
|
title={<GraphValueTooltip base={baseAxis} />}
|
|
197
192
|
>
|
|
198
193
|
<div className={classes.container}>
|
|
199
|
-
<LoadingProgress
|
|
200
|
-
display={loading}
|
|
201
|
-
height={graphHeight}
|
|
202
|
-
width={width}
|
|
203
|
-
/>
|
|
204
194
|
<svg
|
|
205
195
|
height={graphHeight + margin.top}
|
|
206
196
|
ref={graphSvgRef}
|
|
@@ -259,8 +249,7 @@ const LineChart = ({
|
|
|
259
249
|
}}
|
|
260
250
|
timeShiftZonesData={{
|
|
261
251
|
...timeShiftZones,
|
|
262
|
-
graphInterval
|
|
263
|
-
loading
|
|
252
|
+
graphInterval
|
|
264
253
|
}}
|
|
265
254
|
zoomData={{ ...zoomPreview }}
|
|
266
255
|
/>
|
|
@@ -13,8 +13,8 @@ const useSkeletonStyles = makeStyles<Props>()(
|
|
|
13
13
|
display: 'grid',
|
|
14
14
|
gridGap: theme.spacing(1),
|
|
15
15
|
gridTemplateRows: `${
|
|
16
|
-
displayTitleSkeleton ? '
|
|
17
|
-
} ${graphHeight}px ${theme.spacing(
|
|
16
|
+
displayTitleSkeleton ? '0.8fr' : ''
|
|
17
|
+
} ${graphHeight}px ${theme.spacing(2)}`,
|
|
18
18
|
height: '100%'
|
|
19
19
|
},
|
|
20
20
|
loadingSkeletonLine: {
|
|
@@ -30,7 +30,6 @@ interface Props extends Partial<LineChartProps> {
|
|
|
30
30
|
legend: LegendModel;
|
|
31
31
|
limitLegend?: false | number;
|
|
32
32
|
loading: boolean;
|
|
33
|
-
marginBottom?: number;
|
|
34
33
|
shapeLines?: GlobalAreaLines;
|
|
35
34
|
start: string;
|
|
36
35
|
thresholdUnit?: string;
|
|
@@ -54,7 +53,6 @@ const WrapperLineChart = ({
|
|
|
54
53
|
legend,
|
|
55
54
|
header,
|
|
56
55
|
curve = Curve.curveLinear,
|
|
57
|
-
marginBottom = 0,
|
|
58
56
|
thresholds,
|
|
59
57
|
thresholdUnit,
|
|
60
58
|
limitLegend
|
|
@@ -65,7 +63,7 @@ const WrapperLineChart = ({
|
|
|
65
63
|
if (loading && !adjustedData) {
|
|
66
64
|
return (
|
|
67
65
|
<LoadingSkeleton
|
|
68
|
-
displayTitleSkeleton={header?.displayTitle ??
|
|
66
|
+
displayTitleSkeleton={header?.displayTitle ?? false}
|
|
69
67
|
graphHeight={height || 200}
|
|
70
68
|
/>
|
|
71
69
|
);
|
|
@@ -78,7 +76,7 @@ const WrapperLineChart = ({
|
|
|
78
76
|
return (
|
|
79
77
|
<div
|
|
80
78
|
ref={lineChartRef as MutableRefObject<HTMLDivElement>}
|
|
81
|
-
style={{ height: '100%',
|
|
79
|
+
style={{ height: '100%', overflow: 'hidden', width: '100%' }}
|
|
82
80
|
>
|
|
83
81
|
<ParentSize>
|
|
84
82
|
{({
|
|
@@ -98,8 +96,6 @@ const WrapperLineChart = ({
|
|
|
98
96
|
height={height || responsiveHeight}
|
|
99
97
|
legend={legend}
|
|
100
98
|
limitLegend={limitLegend}
|
|
101
|
-
loading={loading}
|
|
102
|
-
marginBottom={marginBottom}
|
|
103
99
|
shapeLines={shapeLines}
|
|
104
100
|
thresholdUnit={thresholdUnit}
|
|
105
101
|
thresholds={thresholds}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { makeStyles } from 'tss-react/mui';
|
|
2
2
|
|
|
3
3
|
export const useTextStyles = makeStyles()((theme) => ({
|
|
4
|
+
critical: {
|
|
5
|
+
color: theme.palette.error.main
|
|
6
|
+
},
|
|
4
7
|
graphText: {
|
|
5
8
|
alignItems: 'center',
|
|
6
9
|
display: 'flex',
|
|
@@ -9,9 +12,17 @@ export const useTextStyles = makeStyles()((theme) => ({
|
|
|
9
12
|
height: '100%',
|
|
10
13
|
justifyContent: 'center'
|
|
11
14
|
},
|
|
15
|
+
threshold: {
|
|
16
|
+
textAlign: 'center'
|
|
17
|
+
},
|
|
12
18
|
thresholds: {
|
|
13
19
|
display: 'flex',
|
|
14
20
|
flexDirection: 'row',
|
|
15
|
-
gap: theme.spacing(5)
|
|
21
|
+
gap: theme.spacing(5),
|
|
22
|
+
whiteSpace: 'nowrap',
|
|
23
|
+
width: '100%'
|
|
24
|
+
},
|
|
25
|
+
warning: {
|
|
26
|
+
color: theme.palette.warning.main
|
|
16
27
|
}
|
|
17
28
|
}));
|
package/src/Graph/Text/Text.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { isNil } from 'ramda';
|
|
|
2
2
|
|
|
3
3
|
import { Typography, useTheme } from '@mui/material';
|
|
4
4
|
|
|
5
|
+
import FluidTypography from '../../Typography/FluidTypography';
|
|
5
6
|
import { LineChartData, Thresholds } from '../common/models';
|
|
6
7
|
import {
|
|
7
8
|
formatMetricValueWithUnit,
|
|
@@ -30,7 +31,7 @@ export const Text = ({
|
|
|
30
31
|
baseColor
|
|
31
32
|
}: Props): JSX.Element | null => {
|
|
32
33
|
const theme = useTheme();
|
|
33
|
-
const { classes } = useTextStyles();
|
|
34
|
+
const { classes, cx } = useTextStyles();
|
|
34
35
|
|
|
35
36
|
if (isNil(data)) {
|
|
36
37
|
return null;
|
|
@@ -74,16 +75,20 @@ export const Text = ({
|
|
|
74
75
|
</Typography>
|
|
75
76
|
{thresholds.enabled && (
|
|
76
77
|
<div className={classes.thresholds}>
|
|
77
|
-
<
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
|
|
78
|
+
<FluidTypography
|
|
79
|
+
containerClassName={cx(classes.threshold, classes.warning)}
|
|
80
|
+
max="30px"
|
|
81
|
+
pref={14}
|
|
82
|
+
text={`${labels.warning}: ${warningThresholdLabels.join(' - ')}`}
|
|
83
|
+
variant="h5"
|
|
84
|
+
/>
|
|
85
|
+
<FluidTypography
|
|
86
|
+
containerClassName={cx(classes.threshold, classes.critical)}
|
|
87
|
+
max="30px"
|
|
88
|
+
pref={14}
|
|
89
|
+
text={`${labels.critical}: ${criticalThresholdLabels.join(' - ')}`}
|
|
90
|
+
variant="h5"
|
|
91
|
+
/>
|
|
87
92
|
</div>
|
|
88
93
|
)}
|
|
89
94
|
</div>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
|
2
|
-
|
|
3
|
-
import { CircularProgress, alpha } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
interface StyleProps {
|
|
6
|
-
height: number;
|
|
7
|
-
width: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const useStyles = makeStyles<StyleProps>()((theme, { height, width }) => ({
|
|
11
|
-
graphLoader: {
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
backgroundColor: alpha(theme.palette.common.white, 0.5),
|
|
14
|
-
display: 'flex',
|
|
15
|
-
height,
|
|
16
|
-
justifyContent: 'center',
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
width
|
|
19
|
-
}
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
interface LoadingProgress {
|
|
23
|
-
display: boolean;
|
|
24
|
-
height: number;
|
|
25
|
-
width: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const LoadingProgress = ({
|
|
29
|
-
display,
|
|
30
|
-
height,
|
|
31
|
-
width
|
|
32
|
-
}: LoadingProgress): JSX.Element | null => {
|
|
33
|
-
const { classes } = useStyles({ height, width });
|
|
34
|
-
|
|
35
|
-
if (!display) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div className={classes.graphLoader}>
|
|
41
|
-
<CircularProgress />
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default LoadingProgress;
|