@centreon/ui 23.10.18-MON-17793-create-graph-component-centreon-ui.23 → 23.10.18-MON-17793-create-graph-component-centreon-ui.25
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/Graph.styles.ts +3 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/AnchorPoint.styles.ts +21 -15
- package/src/Graph/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
- package/src/Graph/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +1 -11
- package/src/Graph/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +2 -13
- 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.25",
|
|
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
|
/>
|
|
@@ -10,11 +10,9 @@ import { GetYAnchorPoint } from './models';
|
|
|
10
10
|
import AnchorPoint from '.';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
|
-
areaColor: string;
|
|
14
13
|
lineColor: string;
|
|
15
14
|
metric: string;
|
|
16
15
|
timeSeries: Array<TimeValue>;
|
|
17
|
-
transparency: number;
|
|
18
16
|
xScale: ScaleTime<number, number>;
|
|
19
17
|
yScale: ScaleLinear<number, number>;
|
|
20
18
|
}
|
|
@@ -36,8 +34,6 @@ const RegularAnchorPoint = ({
|
|
|
36
34
|
yScale,
|
|
37
35
|
metric,
|
|
38
36
|
timeSeries,
|
|
39
|
-
areaColor,
|
|
40
|
-
transparency,
|
|
41
37
|
lineColor
|
|
42
38
|
}: Props): JSX.Element | null => {
|
|
43
39
|
const { tickAxisBottom: timeTick } = useTickGraph({
|
|
@@ -63,13 +59,7 @@ const RegularAnchorPoint = ({
|
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
return (
|
|
66
|
-
<AnchorPoint
|
|
67
|
-
areaColor={areaColor}
|
|
68
|
-
lineColor={lineColor}
|
|
69
|
-
transparency={transparency}
|
|
70
|
-
x={xAnchorPoint}
|
|
71
|
-
y={yAnchorPoint}
|
|
72
|
-
/>
|
|
62
|
+
<AnchorPoint lineColor={lineColor} x={xAnchorPoint} y={yAnchorPoint} />
|
|
73
63
|
);
|
|
74
64
|
};
|
|
75
65
|
|
|
@@ -10,11 +10,9 @@ import useTickGraph from './useTickGraph';
|
|
|
10
10
|
import AnchorPoint from '.';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
|
-
areaColor: string;
|
|
14
13
|
lineColor: string;
|
|
15
14
|
stackValues: Array<StackValue>;
|
|
16
15
|
timeSeries: Array<TimeValue>;
|
|
17
|
-
transparency: number;
|
|
18
16
|
xScale: ScaleTime<number, number>;
|
|
19
17
|
yScale: ScaleLinear<number, number>;
|
|
20
18
|
}
|
|
@@ -25,8 +23,7 @@ interface GetYAnchorPoint {
|
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
const getStackedDates = (stackValues: Array<StackValue>): Array<Date> => {
|
|
28
|
-
const toTimeTick = (stackValue
|
|
29
|
-
stackValue[2]?.data?.timeTick;
|
|
26
|
+
const toTimeTick = (stackValue): string => stackValue?.data?.timeTick;
|
|
30
27
|
|
|
31
28
|
const toDate = (tick: string): Date => new Date(tick);
|
|
32
29
|
|
|
@@ -49,8 +46,6 @@ const StackedAnchorPoint = ({
|
|
|
49
46
|
yScale,
|
|
50
47
|
stackValues,
|
|
51
48
|
timeSeries,
|
|
52
|
-
areaColor,
|
|
53
|
-
transparency,
|
|
54
49
|
lineColor
|
|
55
50
|
}: Props): JSX.Element | null => {
|
|
56
51
|
const { tickAxisBottom: timeTick } = useTickGraph({
|
|
@@ -74,13 +69,7 @@ const StackedAnchorPoint = ({
|
|
|
74
69
|
}
|
|
75
70
|
|
|
76
71
|
return (
|
|
77
|
-
<AnchorPoint
|
|
78
|
-
areaColor={areaColor}
|
|
79
|
-
lineColor={lineColor}
|
|
80
|
-
transparency={transparency}
|
|
81
|
-
x={xAnchorPoint}
|
|
82
|
-
y={yAnchorPoint}
|
|
83
|
-
/>
|
|
72
|
+
<AnchorPoint lineColor={lineColor} x={xAnchorPoint} y={yAnchorPoint} />
|
|
84
73
|
);
|
|
85
74
|
};
|
|
86
75
|
|
|
@@ -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: {
|