@centreon/ui 25.11.1 → 25.11.3

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": "25.11.1",
3
+ "version": "25.11.3",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -90,7 +90,7 @@
90
90
  "@vitejs/plugin-react": "^4.3.4",
91
91
  "@vitejs/plugin-react-swc": "^3.8.0",
92
92
  "chai": "^5.2.0",
93
- "cypress": "^14.1.0",
93
+ "cypress": "^15.5.0",
94
94
  "identity-obj-proxy": "^3.0.0",
95
95
  "jest-transform-stub": "^2.0.0",
96
96
  "mochawesome": "^7.1.3",
@@ -55,12 +55,14 @@ interface Props {
55
55
  dataTestId?: string;
56
56
  disabled?: boolean;
57
57
  label: string;
58
+ id: string;
58
59
  labelPlacement?: LabelPlacement;
59
60
  labelProps?: TypographyProps;
60
61
  onChange?: (e) => void;
61
62
  }
62
63
 
63
64
  const Checkbox = ({
65
+ id,
64
66
  Icon,
65
67
  checked,
66
68
  label,
@@ -86,7 +88,7 @@ const Checkbox = ({
86
88
  className={classes.checkbox}
87
89
  color="primary"
88
90
  disabled={disabled}
89
- id={label}
91
+ id={id}
90
92
  size="small"
91
93
  sx={{ padding: 0 }}
92
94
  onChange={onChange}
@@ -6,6 +6,8 @@ import { TypographyProps } from '@mui/material/Typography';
6
6
 
7
7
  import Checkbox, { LabelPlacement } from '../Checkbox';
8
8
 
9
+ import { useTranslation } from 'react-i18next';
10
+
9
11
  interface Props {
10
12
  className?: string;
11
13
  dataTestId?: string;
@@ -45,6 +47,8 @@ const CheckboxGroup = ({
45
47
  }: Props): JSX.Element => {
46
48
  const { classes, cx } = useStyles();
47
49
 
50
+ const { t } = useTranslation();
51
+
48
52
  const row = !equals(direction, 'vertical');
49
53
 
50
54
  return (
@@ -61,10 +65,11 @@ const CheckboxGroup = ({
61
65
  className={cx(classes.checkbox, className)}
62
66
  disabled={disabled}
63
67
  key={value}
64
- label={value}
68
+ label={t(value)}
65
69
  labelPlacement={labelPlacement}
66
70
  labelProps={labelProps}
67
71
  onChange={onChange}
72
+ id={value}
68
73
  />
69
74
  );
70
75
  })}
@@ -15,7 +15,8 @@ const Checkbox = ({
15
15
  fieldName,
16
16
  getDisabled,
17
17
  hideInput,
18
- dataTestId
18
+ dataTestId,
19
+ label
19
20
  }: InputPropsWithoutGroup): JSX.Element => {
20
21
  const { values, setFieldValue } = useFormikContext<FormikValues>();
21
22
 
@@ -45,7 +46,7 @@ const Checkbox = ({
45
46
  checked={value?.checked}
46
47
  dataTestId={dataTestId || ''}
47
48
  disabled={disabled}
48
- label={value?.label}
49
+ label={label}
49
50
  labelPlacement={checkbox?.labelPlacement || 'end'}
50
51
  onChange={handleChange}
51
52
  />
@@ -137,6 +137,8 @@ const ConnectedAutocomplete = ({
137
137
  getEndpoint={getEndpoint}
138
138
  decoder={connectedAutocomplete?.decoder}
139
139
  getRenderedOptionText={connectedAutocomplete?.getRenderedOptionText}
140
+ getOptionLabel={connectedAutocomplete?.getOptionLabel}
141
+ optionProperty={connectedAutocomplete?.optionProperty}
140
142
  initialPage={1}
141
143
  isOptionEqualToValue={isOptionEqualToValue}
142
144
  label={t(label)}
@@ -62,6 +62,8 @@ export interface InputProps {
62
62
  endpoint?: string;
63
63
  filterKey?: string;
64
64
  getRenderedOptionText?: (option) => string | JSX.Element;
65
+ getOptionLabel?: (option) => string;
66
+ optionProperty?: string;
65
67
  disableSelectAll?: boolean;
66
68
  limitTags?: number;
67
69
  decoder?;
@@ -236,12 +236,12 @@ export const basicFormInputs: Array<InputProps> = [
236
236
  direction: 'horizontal'
237
237
  },
238
238
  fieldName: 'notifications.channels',
239
- label: 'channels',
239
+ label: 'mail',
240
240
  type: InputType.Checkbox
241
241
  },
242
242
  {
243
243
  fieldName: 'notifications.includeServices',
244
- label: 'Iclude services',
244
+ label: 'Include services for this host',
245
245
  type: InputType.Checkbox
246
246
  },
247
247
  {
@@ -65,7 +65,7 @@ const ConnectedAutocompleteField = (
65
65
  open,
66
66
  exclusionOptionProperty = 'id',
67
67
  searchConditions = [],
68
- getRenderedOptionText = (option): string => option.name?.toString(),
68
+ getRenderedOptionText = (option): string => option?.name?.toString(),
69
69
  getRequestHeaders,
70
70
  displayOptionThumbnail,
71
71
  queryKey,
@@ -36,7 +36,7 @@ const MultiAutocompleteField = ({
36
36
  disableSortedOptions = false,
37
37
  disableSelectAll = true,
38
38
  optionProperty = 'name',
39
- getOptionLabel = (option): string => option.name,
39
+ getOptionLabel = (option): string => option?.name,
40
40
  getTagLabel = (option): string => option[optionProperty],
41
41
  getOptionTooltipLabel,
42
42
  chipProps,