@centreon/ui 23.10.18-MON-17793-create-graph-component-centreon-ui.23 → 23.10.18-MON-17793-create-graph-component-centreon-ui.24
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/BasicComponents/Lines/RegularLines/index.tsx +2 -4
- package/src/Graph/InteractiveComponents/AnchorPoint/AnchorPoint.styles.ts +21 -15
- package/src/Graph/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
- package/src/Graph/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +6 -4
- package/src/Graph/InteractiveComponents/AnchorPoint/index.tsx +4 -12
- package/src/Graph/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +6 -6
- package/src/ThemeProvider/palettes.ts +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "23.10.18-MON-17793-create-graph-component-centreon-ui.
|
|
3
|
+
"version": "23.10.18-MON-17793-create-graph-component-centreon-ui.24",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -37,15 +37,13 @@ const RegularLine = ({
|
|
|
37
37
|
transparency,
|
|
38
38
|
graphHeight
|
|
39
39
|
}: Props): JSX.Element => {
|
|
40
|
-
const isHighlighted = highlight ? 3 : 1;
|
|
41
|
-
|
|
42
40
|
const props = {
|
|
43
41
|
curve: Curve.curveLinear,
|
|
44
42
|
data: timeSeries,
|
|
45
43
|
defined: (value): boolean => !isNil(value[metric]),
|
|
46
|
-
opacity:
|
|
44
|
+
opacity: 1,
|
|
47
45
|
stroke: lineColor,
|
|
48
|
-
strokeWidth:
|
|
46
|
+
strokeWidth: !highlight ? 1 : 2,
|
|
49
47
|
unit,
|
|
50
48
|
x: (timeValue): number => xScale(getTime(timeValue)) as number,
|
|
51
49
|
y: (timeValue): number => yScale(prop(metric, timeValue)) ?? null
|
|
@@ -21,31 +21,37 @@ export const useStyles = makeStyles<StylesProps>()(
|
|
|
21
21
|
tooltipTopAxisYRight
|
|
22
22
|
}
|
|
23
23
|
) => ({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
tooltipAxis: {
|
|
25
|
+
'& > span': {
|
|
26
|
+
fontSize: 'inherit',
|
|
27
|
+
fontWeight: 'inherit',
|
|
28
|
+
lineHeight: 'inherit'
|
|
29
|
+
},
|
|
30
|
+
backgroundColor: theme.palette.background.tooltip,
|
|
31
|
+
border: 'unset',
|
|
32
|
+
borderRadius: theme.spacing(0.25),
|
|
33
|
+
color: theme.palette.primary.contrastText,
|
|
34
|
+
fontSize: '10px',
|
|
35
|
+
fontWeight: 500,
|
|
36
|
+
letterSpacing: '0.15px',
|
|
37
|
+
lineHeight: '100%',
|
|
38
|
+
padding: theme.spacing(0.375, 0.5),
|
|
29
39
|
position: 'absolute',
|
|
30
40
|
textAlign: 'center',
|
|
41
|
+
transform: 'translate(-50%, -50%)',
|
|
42
|
+
transformOrigin: 'center center',
|
|
43
|
+
transition: 'unset'
|
|
44
|
+
},
|
|
45
|
+
tooltipAxisBottom: {
|
|
46
|
+
left: tooltipLeftAxisX ?? 0,
|
|
31
47
|
top: tooltipTopAxisX ?? 0
|
|
32
48
|
},
|
|
33
49
|
tooltipAxisLeftY: {
|
|
34
|
-
backgroundColor: theme.palette.background.listingHeader,
|
|
35
|
-
color: theme.palette.common.white,
|
|
36
50
|
left: tooltipLeftAxisYLeft ?? 0,
|
|
37
|
-
minWidth: theme.spacing(3),
|
|
38
|
-
position: 'absolute',
|
|
39
|
-
textAlign: 'center',
|
|
40
51
|
top: tooltipTopAxisYLeft ?? 0
|
|
41
52
|
},
|
|
42
53
|
tooltipLeftAxisRightY: {
|
|
43
|
-
backgroundColor: theme.palette.background.listingHeader,
|
|
44
|
-
color: theme.palette.common.white,
|
|
45
54
|
left: tooltipLeftAxisYRight ?? 0,
|
|
46
|
-
minWidth: theme.spacing(3),
|
|
47
|
-
position: 'absolute',
|
|
48
|
-
textAlign: 'center',
|
|
49
55
|
top: tooltipTopAxisYRight ?? 0
|
|
50
56
|
}
|
|
51
57
|
})
|
|
@@ -26,7 +26,7 @@ const GuidingLines = ({
|
|
|
26
26
|
from={{ x: positionX, y: 0 }}
|
|
27
27
|
pointerEvents="none"
|
|
28
28
|
stroke={grey[400]}
|
|
29
|
-
strokeDasharray="
|
|
29
|
+
strokeDasharray="2 4"
|
|
30
30
|
strokeWidth={1}
|
|
31
31
|
to={{ x: positionX, y: graphHeight }}
|
|
32
32
|
/>
|
|
@@ -34,7 +34,7 @@ const GuidingLines = ({
|
|
|
34
34
|
from={{ x: 0, y: positionY }}
|
|
35
35
|
pointerEvents="none"
|
|
36
36
|
stroke={grey[400]}
|
|
37
|
-
strokeDasharray="
|
|
37
|
+
strokeDasharray="2 4"
|
|
38
38
|
strokeWidth={1}
|
|
39
39
|
to={{ x: graphWidth, y: positionY }}
|
|
40
40
|
/>
|
|
@@ -35,7 +35,7 @@ const TooltipAnchorPoint = ({
|
|
|
35
35
|
timeSeries,
|
|
36
36
|
xScale
|
|
37
37
|
});
|
|
38
|
-
const { classes } = useStyles({
|
|
38
|
+
const { classes, cx } = useStyles({
|
|
39
39
|
tooltipLeftAxisX,
|
|
40
40
|
tooltipLeftAxisYLeft,
|
|
41
41
|
tooltipLeftAxisYRight,
|
|
@@ -47,17 +47,19 @@ const TooltipAnchorPoint = ({
|
|
|
47
47
|
return (
|
|
48
48
|
<>
|
|
49
49
|
{tooltipDataAxisYLeft && (
|
|
50
|
-
<Paper className={classes.tooltipAxisLeftY}>
|
|
50
|
+
<Paper className={cx(classes.tooltipAxis, classes.tooltipAxisLeftY)}>
|
|
51
51
|
<Typography variant="caption">{tooltipDataAxisYLeft}</Typography>
|
|
52
52
|
</Paper>
|
|
53
53
|
)}
|
|
54
54
|
{tooltipDataAxisX && (
|
|
55
|
-
<Paper className={classes.tooltipAxisBottom}>
|
|
55
|
+
<Paper className={cx(classes.tooltipAxis, classes.tooltipAxisBottom)}>
|
|
56
56
|
<Typography variant="caption">{tooltipDataAxisX}</Typography>
|
|
57
57
|
</Paper>
|
|
58
58
|
)}
|
|
59
59
|
{tooltipDataAxisYRight && (
|
|
60
|
-
<Paper
|
|
60
|
+
<Paper
|
|
61
|
+
className={cx(classes.tooltipAxis, classes.tooltipLeftAxisRightY)}
|
|
62
|
+
>
|
|
61
63
|
<Typography variant="caption">{tooltipDataAxisYRight}</Typography>
|
|
62
64
|
</Paper>
|
|
63
65
|
)}
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
-
areaColor: string;
|
|
3
2
|
lineColor: string;
|
|
4
|
-
transparency: number;
|
|
5
3
|
x: number;
|
|
6
4
|
y: number;
|
|
7
5
|
}
|
|
8
6
|
|
|
9
|
-
const Point = ({
|
|
10
|
-
areaColor,
|
|
11
|
-
lineColor,
|
|
12
|
-
transparency,
|
|
13
|
-
x,
|
|
14
|
-
y
|
|
15
|
-
}: Props): JSX.Element => {
|
|
7
|
+
const Point = ({ lineColor, x, y }: Props): JSX.Element => {
|
|
16
8
|
return (
|
|
17
9
|
<circle
|
|
18
10
|
cx={x}
|
|
19
11
|
cy={y}
|
|
20
|
-
fill=
|
|
21
|
-
|
|
22
|
-
r={3}
|
|
12
|
+
fill="white"
|
|
13
|
+
r={4}
|
|
23
14
|
stroke={lineColor}
|
|
15
|
+
strokeWidth={2}
|
|
24
16
|
/>
|
|
25
17
|
);
|
|
26
18
|
};
|
|
@@ -64,8 +64,8 @@ const useTooltipAnchorPoint = ({
|
|
|
64
64
|
|
|
65
65
|
showTooltipAxisX({
|
|
66
66
|
tooltipData: dataAxisX,
|
|
67
|
-
tooltipLeft: positionX + margin.left
|
|
68
|
-
tooltipTop: graphHeight + margin.top
|
|
67
|
+
tooltipLeft: positionX + margin.left,
|
|
68
|
+
tooltipTop: graphHeight + margin.top
|
|
69
69
|
});
|
|
70
70
|
}, [positionX, positionY, tickAxisBottom]);
|
|
71
71
|
|
|
@@ -75,8 +75,8 @@ const useTooltipAnchorPoint = ({
|
|
|
75
75
|
}
|
|
76
76
|
showTooltipAxisYLeft({
|
|
77
77
|
tooltipData: tickAxisLeft,
|
|
78
|
-
tooltipLeft:
|
|
79
|
-
tooltipTop: positionY + margin.top
|
|
78
|
+
tooltipLeft: margin.left,
|
|
79
|
+
tooltipTop: positionY + margin.top
|
|
80
80
|
});
|
|
81
81
|
}, [tickAxisLeft, positionX, positionY]);
|
|
82
82
|
|
|
@@ -86,8 +86,8 @@ const useTooltipAnchorPoint = ({
|
|
|
86
86
|
}
|
|
87
87
|
showTooltipAxisYRight({
|
|
88
88
|
tooltipData: tickAxisRight,
|
|
89
|
-
tooltipLeft: graphWidth ? graphWidth +
|
|
90
|
-
tooltipTop: positionY + margin.top
|
|
89
|
+
tooltipLeft: graphWidth ? graphWidth + margin.left : 0,
|
|
90
|
+
tooltipTop: positionY + margin.top
|
|
91
91
|
});
|
|
92
92
|
}, [positionX, positionY, tickAxisRight]);
|
|
93
93
|
|
|
@@ -18,8 +18,10 @@ declare module '@mui/material/styles' {
|
|
|
18
18
|
background: {
|
|
19
19
|
default: string;
|
|
20
20
|
listingHeader: string;
|
|
21
|
+
panel: string;
|
|
21
22
|
panelGroups: string;
|
|
22
23
|
paper: string;
|
|
24
|
+
tooltip: string;
|
|
23
25
|
};
|
|
24
26
|
pending: {
|
|
25
27
|
contrastText: string;
|
|
@@ -44,9 +46,12 @@ declare module '@mui/material/styles' {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
interface TypeBackground {
|
|
49
|
+
default: string;
|
|
47
50
|
listingHeader: string;
|
|
48
51
|
panel: string;
|
|
49
52
|
panelGroups: string;
|
|
53
|
+
paper: string;
|
|
54
|
+
tooltip: string;
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -84,7 +89,8 @@ export const lightPalette: PaletteOptions = {
|
|
|
84
89
|
listingHeader: '#666666',
|
|
85
90
|
panel: '#EDEDED',
|
|
86
91
|
panelGroups: '#F5F5F5',
|
|
87
|
-
paper: '#FFFFFF'
|
|
92
|
+
paper: '#FFFFFF',
|
|
93
|
+
tooltip: '#434E5B'
|
|
88
94
|
},
|
|
89
95
|
divider: '#E3E3E3',
|
|
90
96
|
error: {
|
|
@@ -155,7 +161,8 @@ export const darkPalette: PaletteOptions = {
|
|
|
155
161
|
listingHeader: '#666666',
|
|
156
162
|
panel: '#4a4a4a',
|
|
157
163
|
panelGroups: '#252525',
|
|
158
|
-
paper: '#212121'
|
|
164
|
+
paper: '#212121',
|
|
165
|
+
tooltip: '#AAB4C0'
|
|
159
166
|
},
|
|
160
167
|
divider: '#666666',
|
|
161
168
|
error: {
|