@centreon/ui 24.11.11 → 24.11.12

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.11.11",
3
+ "version": "24.11.12",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -63,7 +63,7 @@ export const useDashboardLayoutStyles = makeStyles<boolean>()(
63
63
  opacity: 1
64
64
  },
65
65
  position: 'relative',
66
- height: '100%',
66
+ height: '100%'
67
67
  }
68
68
  })
69
69
  );
@@ -1,4 +1,4 @@
1
- import { MutableRefObject, ReactElement, useMemo } from 'react';
1
+ import { ReactElement, useMemo } from 'react';
2
2
 
3
3
  import { scaleLinear } from '@visx/scale';
4
4
  import { Grid as VisxGrid } from '@visx/visx';
@@ -13,15 +13,9 @@ interface Props {
13
13
  columns: number;
14
14
  height: number;
15
15
  width: number;
16
- containerRef: MutableRefObject<HTMLDivElement | null>;
17
16
  }
18
17
 
19
- const Grid = ({
20
- width,
21
- height,
22
- columns,
23
- containerRef
24
- }: Props): ReactElement => {
18
+ const Grid = ({ width, height, columns }: Props): ReactElement => {
25
19
  const theme = useTheme();
26
20
 
27
21
  const xScale = useMemo(
@@ -4,10 +4,7 @@ import { useSetAtom } from 'jotai';
4
4
  import GridLayout, { Layout, WidthProvider } from 'react-grid-layout';
5
5
  import 'react-grid-layout/css/styles.css';
6
6
 
7
- import {
8
- ParentSize,
9
- useMemoComponent
10
- } from '..';
7
+ import { ParentSize, useMemoComponent } from '..';
11
8
 
12
9
  import { Box } from '@mui/material';
13
10
  import { useDashboardLayoutStyles } from './Dashboard.styles';
@@ -33,10 +30,10 @@ const bottom = (layout: Array<Layout>): number => {
33
30
  layout.forEach((panel) => {
34
31
  bottomY = panel.y + panel.h;
35
32
  if (bottomY > max) max = bottomY;
36
- })
33
+ });
37
34
 
38
35
  return max;
39
- }
36
+ };
40
37
 
41
38
  const DashboardLayout = <T extends Layout>({
42
39
  children,
@@ -67,14 +64,10 @@ const DashboardLayout = <T extends Layout>({
67
64
  }, []);
68
65
 
69
66
  const containerHeight = useMemo((): number | undefined => {
70
- const nbRow = bottom(getLayout(layout));
71
- const containerPaddingY = 4
72
- return (
73
- nbRow * rowHeight +
74
- (nbRow - 1) * 20 +
75
- containerPaddingY * 2
76
- );
77
- }, [layout, rowHeight])
67
+ const nbRow = bottom(getLayout(layout));
68
+ const containerPaddingY = 4;
69
+ return nbRow * rowHeight + (nbRow - 1) * 20 + containerPaddingY * 2;
70
+ }, [layout, rowHeight]) ?? 0;
78
71
 
79
72
  useEffect(() => {
80
73
  window.addEventListener('resize', resize);
@@ -86,36 +79,40 @@ const DashboardLayout = <T extends Layout>({
86
79
 
87
80
  return useMemoComponent({
88
81
  Component: (
89
- <Box ref={dashboardContainerRef} sx={{ overflowY: 'auto', overflowX: 'hidden' }}>
90
- <ParentSize>
91
- {({ width, height }): JSX.Element => (
92
- <Box className={classes.container}>
93
- {displayGrid && (
94
- <Grid
95
- columns={columns}
96
- height={(containerHeight || 0) > height ? containerHeight : height}
97
- width={width}
98
- containerRef={dashboardContainerRef}
99
- />
100
- )}
101
- <ReactGridLayout
102
- cols={columns}
103
- containerPadding={[4, 0]}
104
- layout={getLayout(layout)}
105
- margin={[20, 20]}
106
- resizeHandles={['s', 'e', 'se']}
107
- rowHeight={rowHeight}
82
+ <Box
83
+ ref={dashboardContainerRef}
84
+ sx={{ overflowY: 'auto', overflowX: 'hidden' }}
85
+ >
86
+ <ParentSize>
87
+ {({ width, height }): JSX.Element => (
88
+ <Box className={classes.container}>
89
+ {displayGrid && (
90
+ <Grid
91
+ columns={columns}
92
+ height={
93
+ containerHeight > height ? containerHeight : height
94
+ }
108
95
  width={width}
109
- onLayoutChange={changeLayout}
110
- onResizeStart={startResize}
111
- onResizeStop={stopResize}
112
- >
113
- {children}
114
- </ReactGridLayout>
115
- </Box>
116
- )}
117
- </ParentSize>
118
- </Box>
96
+ />
97
+ )}
98
+ <ReactGridLayout
99
+ cols={columns}
100
+ containerPadding={[4, 0]}
101
+ layout={getLayout(layout)}
102
+ margin={[20, 20]}
103
+ resizeHandles={['s', 'e', 'se']}
104
+ rowHeight={rowHeight}
105
+ width={width}
106
+ onLayoutChange={changeLayout}
107
+ onResizeStart={startResize}
108
+ onResizeStop={stopResize}
109
+ >
110
+ {children}
111
+ </ReactGridLayout>
112
+ </Box>
113
+ )}
114
+ </ParentSize>
115
+ </Box>
119
116
  ),
120
117
  memoProps: [columns, layout, displayGrid, isStatic, ...additionalMemoProps]
121
118
  });
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useMemo, useState } from 'react';
2
2
 
3
3
  import { FormikValues, useFormikContext } from 'formik';
4
- import { equals, isNil, map, not, path, prop, type } from 'ramda';
4
+ import { path, equals, isNil, map, not, prop, type } from 'ramda';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { FormHelperText, Stack } from '@mui/material';
@@ -188,7 +188,9 @@ const Autocomplete = ({
188
188
  value={getValues() ?? null}
189
189
  onChange={changeValues}
190
190
  onTextChange={textChange}
191
- style={{ width: autocomplete?.fullWidth ?? true ? 'auto' : '180px' }}
191
+ style={{
192
+ width: (autocomplete?.fullWidth ?? true) ? 'auto' : '180px'
193
+ }}
192
194
  />
193
195
  {inputErrors && (
194
196
  <Stack>
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useMemo } from 'react';
2
2
 
3
3
  import { FormikValues, useFormikContext } from 'formik';
4
- import { equals, isEmpty, path, propEq, reject, split } from 'ramda';
4
+ import { path, equals, isEmpty, propEq, reject, split } from 'ramda';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import {
@@ -1,5 +1,5 @@
1
1
  import { FormikValues, useFormikContext } from 'formik';
2
- import { equals, includes, path, split, type } from 'ramda';
2
+ import { path, equals, includes, split, type } from 'ramda';
3
3
  import { useTranslation } from 'react-i18next';
4
4
 
5
5
  import {
@@ -2,11 +2,11 @@ import { ChangeEvent, useCallback, useState } from 'react';
2
2
 
3
3
  import { FormikValues, useFormikContext } from 'formik';
4
4
  import {
5
+ path,
5
6
  equals,
6
7
  gt,
7
8
  isEmpty,
8
9
  not,
9
- path,
10
10
  split,
11
11
  type as variableType
12
12
  } from 'ramda';
@@ -30,7 +30,7 @@ const initialize = ({
30
30
  tooltip,
31
31
  axis,
32
32
  orientation,
33
- barStyle,
33
+ barStyle
34
34
  }: Pick<
35
35
  BarChartProps,
36
36
  'data' | 'legend' | 'axis' | 'barStyle' | 'orientation' | 'tooltip' | 'start'
@@ -62,14 +62,17 @@ interface Props extends LineChartProps {
62
62
  };
63
63
  }
64
64
 
65
- const filterLines = (lines: Array<Line>, displayThreshold: boolean): Array<Line> => {
65
+ const filterLines = (
66
+ lines: Array<Line>,
67
+ displayThreshold: boolean
68
+ ): Array<Line> => {
66
69
  if (!displayThreshold) {
67
70
  return lines;
68
71
  }
69
72
  const lineOriginMetric = findLineOfOriginMetricThreshold(lines);
70
73
 
71
74
  if (isEmpty(lineOriginMetric)) {
72
- return lines;
75
+ return lines;
73
76
  }
74
77
 
75
78
  const findLinesUpperLower = lines.map((line) =>
@@ -79,7 +79,7 @@ interface Props {
79
79
  transformMatrix?: {
80
80
  fx?: (pointX: number) => number;
81
81
  fy?: (pointY: number) => number;
82
- }
82
+ };
83
83
  }
84
84
 
85
85
  const InteractionWithGraph = ({
@@ -37,7 +37,7 @@ interface Props extends Partial<LineChartProps> {
37
37
  transformMatrix?: {
38
38
  fx?: (pointX: number) => number;
39
39
  fy?: (pointY: number) => number;
40
- }
40
+ };
41
41
  }
42
42
 
43
43
  const WrapperChart = ({
@@ -8,11 +8,11 @@ import {
8
8
  gte,
9
9
  head,
10
10
  isNil,
11
+ last,
11
12
  length,
12
13
  lt,
13
14
  lte,
14
- pluck,
15
- last
15
+ pluck
16
16
  } from 'ramda';
17
17
 
18
18
  import { Theme, darken, getLuminance, lighten } from '@mui/material';
@@ -0,0 +1,12 @@
1
+ import AccountTreeIcon from '@mui/icons-material/AccountTree';
2
+ import { SvgIconProps } from '@mui/material';
3
+
4
+ import BaseIcon from './BaseIcon';
5
+
6
+ export const BusinessActivityIcon = (props: SvgIconProps): JSX.Element => (
7
+ <BaseIcon
8
+ Icon={AccountTreeIcon}
9
+ dataTestId="BusinessActivityIcon"
10
+ {...props}
11
+ />
12
+ );
@@ -0,0 +1,20 @@
1
+ import { SvgIconProps } from '@mui/material';
2
+
3
+ import BaseIcon from './BaseIcon';
4
+
5
+ const icon = (
6
+ <g>
7
+ <path d="M301 745.9L28 662.4c-7.4-2.3-12.5-9.2-12.5-16.9V270.4c0-5.7 2.7-10.9 7.3-14.3 4.6-3.3 10.4-4.2 15.8-2.5l273.1 88.5c7.3 2.4 12.2 9.1 12.2 16.8V729c0 5.6-2.7 10.9-7.2 14.2-3.1 2.3-6.8 3.5-10.5 3.5-1.8-.1-3.5-.3-5.2-.8zm5.2-16.9l5.2-16.9-5.2 16.9zM50.8 632.4l237.8 72.7V371.7l-237.8-77v337.7z" />
8
+ <path d="M295.7 743.2c-4.5-3.3-7.2-8.6-7.2-14.2V358.8c0-7.6 4.9-14.4 12.2-16.8l273.1-88.5c5.4-1.8 11.3-.8 15.8 2.5 4.6 3.4 7.3 8.7 7.3 14.3v375.1c0 7.8-5 14.6-12.5 16.9l-273.1 83.4-5.2-16.9 5.2 16.9c-1.7.5-3.4.8-5.2.8-3.6.1-7.3-1-10.4-3.3zm28.2-371.5V705l237.8-72.7V294.7l-237.8 77zM16.3 275.9c-3-9.3 2.1-19.3 11.4-22.3L300.8 165c9.2-3 19.2 2.1 22.2 11.3 3 9.3-2.1 19.3-11.3 22.2L38.6 287.2c-1.8.6-3.7.9-5.5.9-7.4-.1-14.3-4.8-16.8-12.2z" />
9
+ <path d="M573.9 287.2l-273-88.5c-9.3-3-14.4-13-11.4-22.2 3-9.3 13-14.4 22.2-11.3l273.1 88.5c9.3 3 14.4 13 11.4 22.3-2.4 7.4-9.4 12.2-16.8 12.2-1.9-.1-3.7-.5-5.5-1zm-131.3 42.5l-273.1-88.5c-9.3-3-14.4-13-11.4-22.2 3-9.3 12.9-14.4 22.3-11.4l273 88.5c9.3 3 14.4 13 11.4 22.3-2.4 7.4-9.3 12.2-16.8 12.2-1.7 0-3.5-.3-5.4-.9z" />
10
+ </g>
11
+ );
12
+
13
+ export const ContainerIcon = (props: SvgIconProps): JSX.Element => (
14
+ <BaseIcon
15
+ {...props}
16
+ dataTestId="ContainerIcon"
17
+ Icon={icon}
18
+ viewBox="6 156 600 600"
19
+ />
20
+ );
@@ -10,5 +10,12 @@ const icon = (
10
10
  );
11
11
 
12
12
  export const DowntimeIcon = (props: SvgIconProps): JSX.Element => (
13
- <BaseIcon {...props} Icon={icon} height="24" viewBox="0 0 24 24" width="24" />
13
+ <BaseIcon
14
+ {...props}
15
+ dataTestId="DowntimeIcon"
16
+ Icon={icon}
17
+ height="24"
18
+ viewBox="0 0 24 24"
19
+ width="24"
20
+ />
14
21
  );
@@ -0,0 +1,8 @@
1
+ import BusinessIcon from '@mui/icons-material/Business';
2
+ import { SvgIconProps } from '@mui/material';
3
+
4
+ import BaseIcon from './BaseIcon';
5
+
6
+ export const HostGroupIcon = (props: SvgIconProps): JSX.Element => (
7
+ <BaseIcon Icon={BusinessIcon} dataTestId="HostGroupIcon" {...props} />
8
+ );
@@ -0,0 +1,12 @@
1
+ import SettingsInputSvideoIcon from '@mui/icons-material/SettingsInputSvideo';
2
+ import { SvgIconProps } from '@mui/material';
3
+
4
+ import BaseIcon from './BaseIcon';
5
+
6
+ export const MetaServiceIcon = (props: SvgIconProps): JSX.Element => (
7
+ <BaseIcon
8
+ Icon={SettingsInputSvideoIcon}
9
+ dataTestId="MetaServiceIcon"
10
+ {...props}
11
+ />
12
+ );
@@ -0,0 +1,8 @@
1
+ import LinearScaleIcon from '@mui/icons-material/LinearScale';
2
+ import { SvgIconProps } from '@mui/material';
3
+
4
+ import BaseIcon from './BaseIcon';
5
+
6
+ export const ServiceGroupIcon = (props: SvgIconProps): JSX.Element => (
7
+ <BaseIcon Icon={LinearScaleIcon} dataTestId="ServiceGroupIcon" {...props} />
8
+ );
package/src/Icon/index.ts CHANGED
@@ -1,4 +1,9 @@
1
+ export { DowntimeIcon } from './DowntimeIcon';
2
+ export { AcknowledgementIcon } from './AcknowledgementIcon';
1
3
  export { HostIcon } from './HostIcon';
2
4
  export { ServiceIcon } from './ServiceIcon';
3
- export { DowntimeIcon } from './DowntimeIcon';
4
- export { AcknowledgementIcon } from './AcnowledgementIcon';
5
+ export { BusinessActivityIcon } from './BusinessActivityIcon';
6
+ export { HostGroupIcon } from './HostGroupIcon';
7
+ export { ServiceGroupIcon } from './ServiceGroupIcon';
8
+ export { MetaServiceIcon } from './MetaServiceIcon';
9
+ export { ContainerIcon } from './ContainerIcon';
@@ -526,33 +526,32 @@ const Listing = <
526
526
  className={classes.container}
527
527
  ref={containerRef as RefObject<HTMLDivElement>}
528
528
  >
529
- {
530
- isActionBarVisible &&
531
- <div
532
- className={classes.actionBar}
533
- ref={actionBarRef as RefObject<HTMLDivElement>}
534
- >
535
- <ListingActionBar
536
- actions={actions}
537
- actionsBarMemoProps={actionsBarMemoProps}
538
- columnConfiguration={columnConfiguration}
539
- columns={columns}
540
- currentPage={currentPage}
541
- customPaginationClassName={customPaginationClassName}
542
- limit={limit}
543
- listingVariant={listingVariant}
544
- moveTablePagination={moveTablePagination}
545
- paginated={paginated}
546
- totalRows={totalRows}
547
- viewerModeConfiguration={viewerModeConfiguration}
548
- widthToMoveTablePagination={widthToMoveTablePagination}
549
- onLimitChange={changeLimit}
550
- onPaginate={onPaginate}
551
- onResetColumns={onResetColumns}
552
- onSelectColumns={onSelectColumns}
553
- />
554
- </div>
555
- }
529
+ {isActionBarVisible && (
530
+ <div
531
+ className={classes.actionBar}
532
+ ref={actionBarRef as RefObject<HTMLDivElement>}
533
+ >
534
+ <ListingActionBar
535
+ actions={actions}
536
+ actionsBarMemoProps={actionsBarMemoProps}
537
+ columnConfiguration={columnConfiguration}
538
+ columns={columns}
539
+ currentPage={currentPage}
540
+ customPaginationClassName={customPaginationClassName}
541
+ limit={limit}
542
+ listingVariant={listingVariant}
543
+ moveTablePagination={moveTablePagination}
544
+ paginated={paginated}
545
+ totalRows={totalRows}
546
+ viewerModeConfiguration={viewerModeConfiguration}
547
+ widthToMoveTablePagination={widthToMoveTablePagination}
548
+ onLimitChange={changeLimit}
549
+ onPaginate={onPaginate}
550
+ onResetColumns={onResetColumns}
551
+ onSelectColumns={onSelectColumns}
552
+ />
553
+ </div>
554
+ )}
556
555
 
557
556
  <ParentSize
558
557
  parentSizeStyles={{
@@ -1,11 +1,15 @@
1
- import { forwardRef, type ForwardedRef } from 'react';
1
+ import { type ForwardedRef, forwardRef } from 'react';
2
2
 
3
3
  import { Box, Typography, type TypographyProps } from '@mui/material';
4
4
 
5
5
  const EllipsisTypography = forwardRef(
6
6
  (
7
- { containerClassname, ...props }: TypographyProps & { containerClassname?: string },
8
- ref?: ForwardedRef<HTMLSpanElement>) => {
7
+ {
8
+ containerClassname,
9
+ ...props
10
+ }: TypographyProps & { containerClassname?: string },
11
+ ref?: ForwardedRef<HTMLSpanElement>
12
+ ) => {
9
13
  return (
10
14
  <Box className={containerClassname} sx={{ width: '100%' }}>
11
15
  <Typography
@@ -24,7 +24,7 @@ export const useStyles = makeStyles()((theme) => ({
24
24
  backgroundColor: theme.palette.layout.body.background
25
25
  },
26
26
  '&[data-has-actions="true"]': {
27
- gridTemplateRows: 'min-content auto',
27
+ gridTemplateRows: 'min-content auto'
28
28
  },
29
29
  display: 'grid',
30
30
  gridTemplateRows: 'auto',