@centreon/ui 23.10.83 → 23.10.84
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 +3 -0
- package/src/Dashboard/Item.tsx +3 -2
- package/src/Dashboard/Layout.tsx +8 -5
- package/src/Graph/Gauge/Gauge.tsx +3 -4
- package/src/Graph/LineChart/index.tsx +4 -3
- package/src/ParentSize/ParentSize.tsx +24 -0
- package/src/ParentSize/index.ts +1 -0
- package/src/RichTextEditor/ContentEditable.tsx +4 -0
- package/src/ThemeProvider/palettes.ts +5 -2
- package/src/TimePeriods/index.tsx +4 -3
- package/src/components/DataTable/DataTable.styles.ts +1 -1
- package/src/components/DataTable/Item/DataTableItem.styles.ts +3 -9
- package/src/components/DataTable/Item/DataTableItem.tsx +3 -1
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +4 -2
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +13 -4
- package/src/components/Menu/Menu.styles.ts +6 -8
- package/src/components/Modal/ModalHeader.tsx +1 -1
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -69,6 +69,9 @@ export const useDashboardLayoutStyles = makeStyles<boolean>()(
|
|
|
69
69
|
export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
70
70
|
(theme, { hasHeader }) => ({
|
|
71
71
|
widgetContainer: {
|
|
72
|
+
background: theme.palette.background.widget,
|
|
73
|
+
border: 'none',
|
|
74
|
+
borderRadius: theme.spacing(1),
|
|
72
75
|
height: '100%',
|
|
73
76
|
paddingBottom: theme.spacing(2),
|
|
74
77
|
width: '100%'
|
package/src/Dashboard/Item.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { isNil } from 'ramda';
|
|
10
10
|
|
|
11
|
-
import { Card } from '@mui/material';
|
|
11
|
+
import { Card, useTheme } from '@mui/material';
|
|
12
12
|
|
|
13
13
|
import { useMemoComponent } from '../utils';
|
|
14
14
|
|
|
@@ -46,6 +46,7 @@ const Item = forwardRef(
|
|
|
46
46
|
const hasHeader = !isNil(header);
|
|
47
47
|
|
|
48
48
|
const { classes, cx } = useDashboardItemStyles({ hasHeader });
|
|
49
|
+
const theme = useTheme();
|
|
49
50
|
|
|
50
51
|
const listeners = {
|
|
51
52
|
onMouseDown,
|
|
@@ -85,7 +86,7 @@ const Item = forwardRef(
|
|
|
85
86
|
</Card>
|
|
86
87
|
</div>
|
|
87
88
|
),
|
|
88
|
-
memoProps: [style, className, header]
|
|
89
|
+
memoProps: [style, className, header, theme.palette.mode, canMove]
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
);
|
package/src/Dashboard/Layout.tsx
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Responsive } from '@visx/visx';
|
|
4
3
|
import GridLayout, { Layout, WidthProvider } from 'react-grid-layout';
|
|
5
4
|
import 'react-grid-layout/css/styles.css';
|
|
6
5
|
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Responsive as ResponsiveHeight,
|
|
8
|
+
ParentSize,
|
|
9
|
+
useMemoComponent
|
|
10
|
+
} from '..';
|
|
8
11
|
|
|
9
12
|
import { useDashboardLayoutStyles } from './Dashboard.styles';
|
|
10
13
|
import { getColumnsFromScreenSize, getLayout, rowHeight } from './utils';
|
|
@@ -46,7 +49,7 @@ const Layout = <T extends Layout>({
|
|
|
46
49
|
return useMemoComponent({
|
|
47
50
|
Component: (
|
|
48
51
|
<ResponsiveHeight margin={40}>
|
|
49
|
-
<
|
|
52
|
+
<ParentSize>
|
|
50
53
|
{({ width, height }): JSX.Element => (
|
|
51
54
|
<div className={classes.container}>
|
|
52
55
|
{displayGrid && (
|
|
@@ -66,10 +69,10 @@ const Layout = <T extends Layout>({
|
|
|
66
69
|
</ReactGridLayout>
|
|
67
70
|
</div>
|
|
68
71
|
)}
|
|
69
|
-
</
|
|
72
|
+
</ParentSize>
|
|
70
73
|
</ResponsiveHeight>
|
|
71
74
|
),
|
|
72
|
-
memoProps: [columns, layout, displayGrid]
|
|
75
|
+
memoProps: [columns, layout, displayGrid, isStatic]
|
|
73
76
|
});
|
|
74
77
|
};
|
|
75
78
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ParentSize } from '../..';
|
|
3
2
|
import { LineChartData, Thresholds } from '../common/models';
|
|
4
3
|
import { getMetricWithLatestData } from '../common/timeSeries';
|
|
5
4
|
import { Metric } from '../common/timeSeries/models';
|
|
@@ -26,7 +25,7 @@ export const Gauge = ({
|
|
|
26
25
|
const metric = getMetricWithLatestData(data) as Metric;
|
|
27
26
|
|
|
28
27
|
return (
|
|
29
|
-
<
|
|
28
|
+
<ParentSize>
|
|
30
29
|
{({ width, height }) => (
|
|
31
30
|
<ResponsiveGauge
|
|
32
31
|
baseColor={baseColor}
|
|
@@ -37,6 +36,6 @@ export const Gauge = ({
|
|
|
37
36
|
width={width}
|
|
38
37
|
/>
|
|
39
38
|
)}
|
|
40
|
-
</
|
|
39
|
+
</ParentSize>
|
|
41
40
|
);
|
|
42
41
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Curve
|
|
3
|
+
import { Curve } from '@visx/visx';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import 'dayjs/locale/en';
|
|
6
6
|
import 'dayjs/locale/es';
|
|
@@ -10,6 +10,7 @@ import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
|
10
10
|
import timezonePlugin from 'dayjs/plugin/timezone';
|
|
11
11
|
import utcPlugin from 'dayjs/plugin/utc';
|
|
12
12
|
|
|
13
|
+
import { ParentSize } from '../..';
|
|
13
14
|
import { LineChartData, Thresholds } from '../common/models';
|
|
14
15
|
|
|
15
16
|
import LineChart from './LineChart';
|
|
@@ -77,7 +78,7 @@ const WrapperLineChart = ({
|
|
|
77
78
|
ref={lineChartRef as MutableRefObject<HTMLDivElement>}
|
|
78
79
|
style={{ height: '100%', width: '100%' }}
|
|
79
80
|
>
|
|
80
|
-
<
|
|
81
|
+
<ParentSize>
|
|
81
82
|
{({
|
|
82
83
|
height: responsiveHeight,
|
|
83
84
|
width: responsiveWidth
|
|
@@ -106,7 +107,7 @@ const WrapperLineChart = ({
|
|
|
106
107
|
/>
|
|
107
108
|
);
|
|
108
109
|
}}
|
|
109
|
-
</
|
|
110
|
+
</ParentSize>
|
|
110
111
|
</div>
|
|
111
112
|
);
|
|
112
113
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Responsive } from '@visx/visx';
|
|
4
|
+
|
|
5
|
+
type ParentSizeState = {
|
|
6
|
+
height: number;
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
width: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
children: (args: ParentSizeState) => ReactElement;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const ParentSize = ({ children, ...props }: Props): JSX.Element => {
|
|
17
|
+
return (
|
|
18
|
+
<Responsive.ParentSize {...props} debounceTime={0}>
|
|
19
|
+
{children}
|
|
20
|
+
</Responsive.ParentSize>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default ParentSize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ParentSize } from './ParentSize';
|
|
@@ -35,6 +35,9 @@ const useStyles = makeStyles<StyleProps>()(
|
|
|
35
35
|
? `1px solid ${theme.palette.error.main}`
|
|
36
36
|
: `1px solid ${theme.palette.primary.main}`
|
|
37
37
|
},
|
|
38
|
+
notEditable: {
|
|
39
|
+
backgroundColor: 'transparent'
|
|
40
|
+
},
|
|
38
41
|
placeholder: {
|
|
39
42
|
color: theme.palette.grey[500],
|
|
40
43
|
pointerEvents: 'none'
|
|
@@ -162,6 +165,7 @@ const ContentEditable = ({
|
|
|
162
165
|
className={cx(
|
|
163
166
|
classes.root,
|
|
164
167
|
editable && classes.container,
|
|
168
|
+
!isEditable && !disabled && classes.notEditable,
|
|
165
169
|
className,
|
|
166
170
|
isFocused && classes.inputFocused
|
|
167
171
|
)}
|
|
@@ -55,6 +55,7 @@ declare module '@mui/material/styles' {
|
|
|
55
55
|
panelGroups: string;
|
|
56
56
|
paper: string;
|
|
57
57
|
tooltip: string;
|
|
58
|
+
widget: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
interface TypeLayout {
|
|
@@ -162,7 +163,8 @@ export const lightPalette: PaletteOptions = {
|
|
|
162
163
|
panel: '#EDEDED',
|
|
163
164
|
panelGroups: '#F5F5F5',
|
|
164
165
|
paper: '#FFFFFF',
|
|
165
|
-
tooltip: '#434E5B'
|
|
166
|
+
tooltip: '#434E5B',
|
|
167
|
+
widget: '#F8F8F8'
|
|
166
168
|
},
|
|
167
169
|
chip: {
|
|
168
170
|
color: {
|
|
@@ -301,7 +303,8 @@ export const darkPalette: PaletteOptions = {
|
|
|
301
303
|
panel: '#4a4a4a',
|
|
302
304
|
panelGroups: '#252525',
|
|
303
305
|
paper: '#212121',
|
|
304
|
-
tooltip: '#AAB4C0'
|
|
306
|
+
tooltip: '#AAB4C0',
|
|
307
|
+
widget: '#2E2E2E'
|
|
305
308
|
},
|
|
306
309
|
chip: {
|
|
307
310
|
color: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Responsive } from '@visx/visx';
|
|
4
3
|
import dayjs from 'dayjs';
|
|
5
4
|
import 'dayjs/locale/en';
|
|
6
5
|
import 'dayjs/locale/es';
|
|
@@ -13,6 +12,8 @@ import utcPlugin from 'dayjs/plugin/utc';
|
|
|
13
12
|
|
|
14
13
|
import { Paper } from '@mui/material';
|
|
15
14
|
|
|
15
|
+
import { ParentSize } from '..';
|
|
16
|
+
|
|
16
17
|
import CustomTimePeriod from './CustomTimePeriod';
|
|
17
18
|
import SelectedTimePeriod from './SelectedTimePeriod';
|
|
18
19
|
import { useStyles } from './TimePeriods.styles';
|
|
@@ -57,7 +58,7 @@ const TimePeriod = ({
|
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
60
|
<div>
|
|
60
|
-
<
|
|
61
|
+
<ParentSize>
|
|
61
62
|
{({ width }): JSX.Element => {
|
|
62
63
|
return (
|
|
63
64
|
<Paper className={classes.header} style={{ width }}>
|
|
@@ -71,7 +72,7 @@ const TimePeriod = ({
|
|
|
71
72
|
</Paper>
|
|
72
73
|
);
|
|
73
74
|
}}
|
|
74
|
-
</
|
|
75
|
+
</ParentSize>
|
|
75
76
|
</div>
|
|
76
77
|
);
|
|
77
78
|
};
|
|
@@ -8,7 +8,7 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
8
8
|
},
|
|
9
9
|
display: 'grid',
|
|
10
10
|
gridGap: theme.spacing(2.5),
|
|
11
|
-
gridTemplateColumns:
|
|
11
|
+
gridTemplateColumns: `repeat(auto-fill, ${theme.spacing(45)})`
|
|
12
12
|
},
|
|
13
13
|
'&[data-variant][data-is-empty="true"]': {
|
|
14
14
|
display: 'flex',
|
|
@@ -16,23 +16,17 @@ const useStyles = makeStyles()((theme) => ({
|
|
|
16
16
|
},
|
|
17
17
|
display: 'flex',
|
|
18
18
|
|
|
19
|
-
justifyContent: 'space-between'
|
|
20
|
-
opacity: 0
|
|
21
|
-
},
|
|
22
|
-
'&:hover .MuiCardActions-root': {
|
|
23
|
-
opacity: 1
|
|
19
|
+
justifyContent: 'space-between'
|
|
24
20
|
},
|
|
25
21
|
borderRadius: theme.shape.borderRadius,
|
|
26
22
|
display: 'flex',
|
|
27
23
|
flexDirection: 'column',
|
|
28
|
-
height: '
|
|
29
|
-
minWidth: '280px',
|
|
24
|
+
height: '186px',
|
|
30
25
|
p: {
|
|
31
26
|
color: theme.palette.text.secondary,
|
|
32
27
|
letterSpacing: '0',
|
|
33
28
|
margin: '0'
|
|
34
|
-
}
|
|
35
|
-
width: '320px'
|
|
29
|
+
}
|
|
36
30
|
}
|
|
37
31
|
}));
|
|
38
32
|
|
|
@@ -58,7 +58,9 @@ const DataTableItem = forwardRef(
|
|
|
58
58
|
>
|
|
59
59
|
<ActionArea aria-label="view" onClick={() => onClick?.()}>
|
|
60
60
|
<MuiCardContent>
|
|
61
|
-
<MuiTypography variant="h5">
|
|
61
|
+
<MuiTypography fontWeight={500} variant="h5">
|
|
62
|
+
{title}
|
|
63
|
+
</MuiTypography>
|
|
62
64
|
{description && <MuiTypography>{description}</MuiTypography>}
|
|
63
65
|
</MuiCardContent>
|
|
64
66
|
</ActionArea>
|
|
@@ -11,7 +11,9 @@ export const useStyles = makeStyles()((theme) => ({
|
|
|
11
11
|
display: 'flex',
|
|
12
12
|
gap: theme.spacing(0.5)
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
'&[data-row-reverse="true"]': {
|
|
15
|
+
flexDirection: 'row-reverse'
|
|
16
|
+
},
|
|
15
17
|
display: 'flex',
|
|
16
18
|
justifyContent: 'space-between',
|
|
17
19
|
paddingBottom: theme.spacing(2.5)
|
|
@@ -23,7 +25,7 @@ export const useStyles = makeStyles()((theme) => ({
|
|
|
23
25
|
display: 'grid',
|
|
24
26
|
gridTemplateRows: 'min-content',
|
|
25
27
|
overflow: 'hidden',
|
|
26
|
-
padding: theme.spacing(
|
|
28
|
+
padding: theme.spacing(2, 3, 5)
|
|
27
29
|
},
|
|
28
30
|
pageLayoutHeader: {
|
|
29
31
|
'[data-variant="fixed-header"] &': {
|
|
@@ -2,14 +2,23 @@ import { ReactElement, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useStyles } from './PageLayout.styles';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface PageLayoutActionsProps {
|
|
6
6
|
children: Array<ReactNode> | ReactNode;
|
|
7
|
-
|
|
7
|
+
rowReverse?: boolean;
|
|
8
|
+
}
|
|
8
9
|
|
|
9
10
|
export const PageLayoutActions = ({
|
|
10
|
-
children
|
|
11
|
+
children,
|
|
12
|
+
rowReverse
|
|
11
13
|
}: PageLayoutActionsProps): ReactElement => {
|
|
12
14
|
const { classes } = useStyles();
|
|
13
15
|
|
|
14
|
-
return
|
|
16
|
+
return (
|
|
17
|
+
<section
|
|
18
|
+
className={classes.pageLayoutActions}
|
|
19
|
+
data-row-reverse={rowReverse}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</section>
|
|
23
|
+
);
|
|
15
24
|
};
|
|
@@ -9,15 +9,8 @@ export const useStyles = makeStyles()((theme) => ({
|
|
|
9
9
|
menuItem: {
|
|
10
10
|
'&, &.MuiMenuItem-root': {
|
|
11
11
|
'& > button': {
|
|
12
|
-
'&:hover:not(&[data-is-active="true"])': {
|
|
13
|
-
backgroundColor: theme.palette.menu.item.background.hover,
|
|
14
|
-
color: theme.palette.menu.item.color.hover
|
|
15
|
-
},
|
|
16
|
-
backgroundColor: theme.palette.menu.item.background.default,
|
|
17
|
-
color: theme.palette.menu.item.color.default,
|
|
18
12
|
fontSize: '1rem',
|
|
19
|
-
justifyContent: 'flex-start'
|
|
20
|
-
width: '100%'
|
|
13
|
+
justifyContent: 'flex-start'
|
|
21
14
|
},
|
|
22
15
|
|
|
23
16
|
'&:has(button)': {
|
|
@@ -51,7 +44,12 @@ export const useStyles = makeStyles()((theme) => ({
|
|
|
51
44
|
padding: theme.spacing(0.75, 2)
|
|
52
45
|
},
|
|
53
46
|
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'row',
|
|
54
50
|
fontSize: '1rem',
|
|
51
|
+
gap: theme.spacing(2),
|
|
52
|
+
justifyContent: 'space-between',
|
|
55
53
|
minHeight: 'unset'
|
|
56
54
|
}
|
|
57
55
|
},
|
package/src/index.ts
CHANGED