@centreon/ui 24.5.8 → 24.5.9

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.
Files changed (78) hide show
  1. package/package.json +4 -8
  2. package/public/mockServiceWorker.js +100 -81
  3. package/src/ActionsList/index.stories.tsx +1 -7
  4. package/src/Dashboard/Dashboard.styles.ts +2 -3
  5. package/src/Dashboard/Item.tsx +5 -39
  6. package/src/Dashboard/Layout.tsx +2 -4
  7. package/src/Dashboard/utils.ts +1 -1
  8. package/src/Graph/BarStack/BarStack.stories.tsx +6 -8
  9. package/src/Graph/BarStack/ResponsiveBarStack.tsx +3 -3
  10. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -20
  11. package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +8 -12
  12. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +8 -8
  13. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/BasicThreshold.tsx +2 -1
  14. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +2 -1
  15. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +2 -1
  16. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +2 -1
  17. package/src/Graph/LineChart/BasicComponents/Lines/index.tsx +2 -1
  18. package/src/Graph/LineChart/BasicComponents/Lines/models.ts +3 -0
  19. package/src/Graph/LineChart/Legend/LegendHeader.tsx +1 -4
  20. package/src/Graph/LineChart/LineChart.cypress.spec.tsx +0 -53
  21. package/src/Graph/LineChart/LineChart.tsx +2 -1
  22. package/src/Graph/LineChart/common/index.ts +1 -15
  23. package/src/Graph/LineChart/index.stories.tsx +3 -15
  24. package/src/Graph/LineChart/index.tsx +4 -2
  25. package/src/Graph/LineChart/useLineChartData.ts +18 -57
  26. package/src/Graph/PieChart/PieChart.stories.tsx +15 -11
  27. package/src/Graph/PieChart/ResponsivePie.tsx +1 -1
  28. package/src/Graph/Tree/DescendantNodes.tsx +0 -1
  29. package/src/Graph/Tree/Links.tsx +2 -15
  30. package/src/Graph/Tree/Tree.cypress.spec.tsx +0 -24
  31. package/src/Graph/Tree/Tree.stories.tsx +1 -17
  32. package/src/Graph/Tree/models.ts +0 -3
  33. package/src/Graph/common/utils.ts +1 -49
  34. package/src/Listing/Cell/index.tsx +23 -17
  35. package/src/TimePeriods/index.stories.tsx +12 -7
  36. package/src/TopCounterElements/TopCounterLayout.tsx +4 -3
  37. package/src/api/QueryProvider.tsx +1 -1
  38. package/src/api/useFetchQuery/index.test.ts +5 -0
  39. package/src/api/useFetchQuery/index.ts +7 -12
  40. package/src/api/useGraphQuery/index.ts +2 -9
  41. package/src/api/useMutationQuery/index.ts +5 -2
  42. package/src/api/useRequest/index.test.ts +3 -0
  43. package/src/api/useRequest/index.ts +6 -3
  44. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +13 -27
  45. package/src/components/Form/AccessRights/AccessRights.stories.tsx +19 -0
  46. package/src/components/Form/AccessRights/AccessRights.styles.ts +1 -1
  47. package/src/components/Form/AccessRights/AccessRights.tsx +5 -6
  48. package/src/components/Form/AccessRights/Actions/Actions.styles.ts +7 -3
  49. package/src/components/Form/AccessRights/Actions/Actions.tsx +32 -15
  50. package/src/components/Form/AccessRights/Actions/useActions.ts +37 -4
  51. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +0 -1
  52. package/src/components/Form/AccessRights/models.ts +3 -0
  53. package/src/components/Form/AccessRights/storiesData.ts +3 -0
  54. package/src/components/Form/Dashboard/DashboardForm.stories.ts +39 -0
  55. package/src/components/Form/Dashboard/translatedLabels.ts +1 -0
  56. package/src/components/List/Item/ListItem.styles.ts +2 -2
  57. package/src/components/Modal/Modal.styles.ts +5 -5
  58. package/src/components/Zoom/Minimap.tsx +2 -4
  59. package/src/components/Zoom/Zoom.cypress.spec.tsx +13 -13
  60. package/src/components/Zoom/Zoom.tsx +1 -4
  61. package/src/components/Zoom/ZoomContent.tsx +2 -5
  62. package/src/components/index.ts +0 -1
  63. package/src/index.ts +1 -1
  64. package/src/utils/index.ts +0 -1
  65. package/src/utils/usePluralizedTranslation.ts +3 -20
  66. package/src/Dashboard/Dashboard.cypress.spec.tsx +0 -68
  67. package/src/Graph/LineChart/mockedData/curvesWithSameColor.json +0 -252
  68. package/src/api/logger.ts +0 -11
  69. package/src/components/Form/AccessRights/useAccessRightsChange.ts +0 -30
  70. package/src/components/Form/AccessRights/utils.ts +0 -18
  71. package/src/components/Tabs/Tab.styles.ts +0 -25
  72. package/src/components/Tabs/TabPanel.tsx +0 -22
  73. package/src/components/Tabs/Tabs.cypress.spec.tsx +0 -70
  74. package/src/components/Tabs/Tabs.stories.tsx +0 -55
  75. package/src/components/Tabs/Tabs.tsx +0 -55
  76. package/src/components/Tabs/index.ts +0 -6
  77. package/src/utils/resourcesStatusURL.ts +0 -166
  78. package/src/utils/usePluralizedTranslation.test.ts +0 -159
@@ -1,32 +1,64 @@
1
1
  import { useAtomValue } from 'jotai';
2
- import { equals } from 'ramda';
2
+ import { equals, omit } from 'ramda';
3
3
 
4
4
  import { initialValuesAtom, valuesAtom } from '../atoms';
5
- import { AccessRightInitialValues, Labels } from '../models';
6
- import { formatValue, formatValueForSubmition } from '../utils';
5
+ import { AccessRight, AccessRightInitialValues, Labels } from '../models';
6
+ import { useCopyToClipboard } from '../../../..';
7
+
8
+ const formatValue = (accessRight: AccessRight): AccessRightInitialValues => {
9
+ return omit(['isAdded', 'isUpdated', 'isRemoved'], accessRight);
10
+ };
11
+
12
+ const formatValueForSubmition = (
13
+ accessRight: AccessRight
14
+ ): AccessRightInitialValues => {
15
+ return {
16
+ ...formatValue(accessRight),
17
+ id: Number((accessRight.id as string).split('_')[1])
18
+ };
19
+ };
7
20
 
8
21
  interface Props {
9
22
  clear: () => void;
10
23
  labels: Labels['actions'];
24
+ link?: string;
11
25
  submit: (values: Array<AccessRightInitialValues>) => Promise<void>;
12
26
  }
13
27
 
14
28
  interface UseActionsState {
29
+ copyLink: () => void;
15
30
  dirty: boolean;
16
31
  formattedValues: Array<AccessRightInitialValues>;
17
32
  save: () => void;
18
33
  }
19
34
 
20
- export const useActions = ({ submit, clear }: Props): UseActionsState => {
35
+ export const useActions = ({
36
+ link,
37
+ labels,
38
+ submit,
39
+ clear
40
+ }: Props): UseActionsState => {
21
41
  const values = useAtomValue(valuesAtom);
22
42
  const initialValues = useAtomValue(initialValuesAtom);
23
43
 
44
+ const { copy } = useCopyToClipboard({
45
+ errorMessage: labels.copyError,
46
+ successMessage: labels.copySuccess
47
+ });
48
+
24
49
  const formattedValues = values
25
50
  .filter(({ isRemoved }) => !isRemoved)
26
51
  .map(formatValue);
27
52
 
28
53
  const dirty = !equals(initialValues, formattedValues);
29
54
 
55
+ const copyLink = (): void => {
56
+ if (!link) {
57
+ return;
58
+ }
59
+ copy(link);
60
+ };
61
+
30
62
  const save = (): void => {
31
63
  submit(
32
64
  values.filter(({ isRemoved }) => !isRemoved).map(formatValueForSubmition)
@@ -39,6 +71,7 @@ export const useActions = ({ submit, clear }: Props): UseActionsState => {
39
71
  };
40
72
 
41
73
  return {
74
+ copyLink,
42
75
  dirty,
43
76
  formattedValues,
44
77
  save
@@ -68,7 +68,6 @@ const ShareInput = ({ labels, endpoints, roles }: Props): JSX.Element => {
68
68
  data-testid="add"
69
69
  disabled={isNil(selectedContact)}
70
70
  icon={<AddCircleIcon />}
71
- size="small"
72
71
  onClick={add}
73
72
  />
74
73
  </div>
@@ -16,6 +16,9 @@ export interface AccessRight extends AccessRightInitialValues {
16
16
  export interface Labels {
17
17
  actions: {
18
18
  cancel: string;
19
+ copyError: string;
20
+ copyLink: string;
21
+ copySuccess: string;
19
22
  save: string;
20
23
  };
21
24
  add: {
@@ -105,6 +105,9 @@ export const buildResult = (isGroup): Listing<SelectEntry> => ({
105
105
  export const labels: Labels = {
106
106
  actions: {
107
107
  cancel: 'Cancel',
108
+ copyError: 'Failed to copy',
109
+ copyLink: 'Copy link',
110
+ copySuccess: 'Copied',
108
111
  save: 'Save'
109
112
  },
110
113
  add: {
@@ -0,0 +1,39 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { DashboardForm } from './DashboardForm';
4
+
5
+ const meta: Meta<typeof DashboardForm> = {
6
+ component: DashboardForm
7
+ };
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof DashboardForm>;
11
+
12
+ export const Default: Story = {
13
+ args: {
14
+ labels: {
15
+ actions: {
16
+ cancel: 'Cancel',
17
+ submit: {
18
+ create: 'Create',
19
+ update: 'Update'
20
+ }
21
+ },
22
+ entity: {
23
+ description: 'Description',
24
+ name: 'Name'
25
+ }
26
+ }
27
+ }
28
+ };
29
+
30
+ export const AsUpdateVariant: Story = {
31
+ args: {
32
+ ...Default.args,
33
+ resource: {
34
+ description: 'Description 1',
35
+ name: 'Dashboard 1'
36
+ },
37
+ variant: 'update'
38
+ }
39
+ };
@@ -1,3 +1,4 @@
1
+ // TODO use i18n conventions for translation (interpolation, plurals, etc.) and setup for storybook (only works in FE atm.)
1
2
  export const labelMustBeMost = '{{label}} can be at most {{max}} characters';
2
3
  export const labelMustBeAtLeast =
3
4
  '{{label}} should be at least {{min}} characters long';
@@ -18,10 +18,10 @@ export const useStyles = makeStyles()((theme) => ({
18
18
  display: 'flex',
19
19
  flexGrow: 1,
20
20
  gap: theme.spacing(2),
21
+ maxWidth: '520px',
21
22
  overflow: 'hidden',
22
23
  paddingBottom: theme.spacing(1),
23
- paddingTop: theme.spacing(1),
24
- width: '100%'
24
+ paddingTop: theme.spacing(1)
25
25
  },
26
26
  secondary: {
27
27
  alignItems: 'center',
@@ -9,7 +9,7 @@ const useStyles = makeStyles<{
9
9
  modal: {
10
10
  '& .MuiDialog-paper': {
11
11
  gap: theme.spacing(2),
12
- padding: theme.spacing(2.5)
12
+ padding: theme.spacing(2)
13
13
  },
14
14
  '&[data-size="fullscreen"]': {
15
15
  zIndex: 0
@@ -35,8 +35,8 @@ const useStyles = makeStyles<{
35
35
  transition: theme.transitions.create('left')
36
36
  },
37
37
  '&[data-size="large"] .MuiDialog-paper': {
38
- maxWidth: '604px',
39
- width: '604px'
38
+ maxWidth: '640px',
39
+ width: '640px'
40
40
  },
41
41
  '&[data-size="medium"] .MuiDialog-paper': {
42
42
  width: '520px'
@@ -52,7 +52,6 @@ const useStyles = makeStyles<{
52
52
  modalActions: {
53
53
  '&[data-fixed="true"]': {
54
54
  background: theme.palette.background.paper,
55
- padding: theme.spacing(1, 2.5, 2.5, 0),
56
55
  position: 'fixed',
57
56
  width: '100%'
58
57
  },
@@ -61,7 +60,7 @@ const useStyles = makeStyles<{
61
60
  flexDirection: 'row',
62
61
  gap: theme.spacing(2),
63
62
  justifyContent: 'flex-end',
64
- padding: theme.spacing(1, 0, 0, 0),
63
+ padding: theme.spacing(1, 2.5, 2.5, 0),
65
64
  right: 0,
66
65
  zIndex: theme.zIndex.modal
67
66
  },
@@ -70,6 +69,7 @@ const useStyles = makeStyles<{
70
69
  '&:first-of-type': {
71
70
  margin: theme.spacing(0, 0, 1, 0)
72
71
  },
72
+ color: theme.palette.text.secondary,
73
73
  margin: theme.spacing(1, 0, 1, 0),
74
74
  width: '90%'
75
75
  }
@@ -16,7 +16,6 @@ interface Props extends Omit<UseMinimapProps, 'minimapScale' | 'scale'> {
16
16
  left: number;
17
17
  top: number;
18
18
  };
19
- id?: number | string;
20
19
  isDraggingFromContainer: boolean;
21
20
  }
22
21
 
@@ -27,8 +26,7 @@ const Minimap = ({
27
26
  width,
28
27
  contentClientRect,
29
28
  isDraggingFromContainer,
30
- diffBetweenContentAndSvg,
31
- id
29
+ diffBetweenContentAndSvg
32
30
  }: Props): JSX.Element => {
33
31
  const { classes } = useZoomStyles();
34
32
 
@@ -84,7 +82,7 @@ const Minimap = ({
84
82
  );
85
83
 
86
84
  return (
87
- <g className={classes.minimap} clipPath={`url(#zoom-clip-${id})`}>
85
+ <g className={classes.minimap} clipPath="url(#zoom-clip)">
88
86
  <rect
89
87
  className={classes.minimapBackground}
90
88
  height={finalHeight}
@@ -63,7 +63,7 @@ describe('Zoom', () => {
63
63
  it('displays the minimap when the prop is set', () => {
64
64
  initialize({ showMinimap: true });
65
65
 
66
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
66
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
67
67
 
68
68
  cy.makeSnapshot();
69
69
  });
@@ -72,7 +72,7 @@ describe('Zoom', () => {
72
72
  initialize({ showMinimap: true });
73
73
 
74
74
  cy.get('g[transform="matrix(1, 0, 0, 1, 0, 0)"]');
75
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
75
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
76
76
 
77
77
  cy.findByTestId('zoom in').click();
78
78
  cy.findByTestId('zoom-content')
@@ -86,7 +86,7 @@ describe('Zoom', () => {
86
86
  initialize({ showMinimap: true });
87
87
 
88
88
  cy.get('g[transform="matrix(1, 0, 0, 1, 0, 0)"]');
89
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
89
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
90
90
 
91
91
  cy.findByTestId('zoom out').click();
92
92
 
@@ -101,7 +101,7 @@ describe('Zoom', () => {
101
101
  initialize({ showMinimap: true });
102
102
 
103
103
  cy.get('g[transform="matrix(1, 0, 0, 1, 0, 0)"]');
104
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
104
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
105
105
 
106
106
  cy.findByTestId('zoom-content').realMouseWheel({ deltaY: 20 });
107
107
 
@@ -116,7 +116,7 @@ describe('Zoom', () => {
116
116
  initialize({ showMinimap: true });
117
117
 
118
118
  cy.get('g[transform="matrix(1, 0, 0, 1, 0, 0)"]');
119
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
119
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
120
120
 
121
121
  cy.findByTestId('zoom-content').realMouseWheel({ deltaY: -20 });
122
122
 
@@ -131,7 +131,7 @@ describe('Zoom', () => {
131
131
  initialize({ showMinimap: true });
132
132
 
133
133
  cy.get('g[transform="matrix(1, 0, 0, 1, 0, 0)"]');
134
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
134
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
135
135
 
136
136
  cy.findByTestId('zoom-content').realMouseWheel({ deltaY: -20 });
137
137
 
@@ -150,7 +150,7 @@ describe('Zoom', () => {
150
150
  initialize({ showMinimap: false });
151
151
 
152
152
  cy.get('g[transform="matrix(1, 0, 0, 1, 0, 0)"]');
153
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('not.exist');
153
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('not.exist');
154
154
 
155
155
  cy.makeSnapshot();
156
156
  });
@@ -158,7 +158,7 @@ describe('Zoom', () => {
158
158
  it('zooms in when the minimap is scrolled up', () => {
159
159
  initialize({ showMinimap: true });
160
160
 
161
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
161
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
162
162
 
163
163
  cy.findByTestId('minimap-interaction').realMouseWheel({ deltaY: -20 });
164
164
 
@@ -172,7 +172,7 @@ describe('Zoom', () => {
172
172
  it('zooms out when the minimap is scrolled down', () => {
173
173
  initialize({ showMinimap: true });
174
174
 
175
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
175
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
176
176
 
177
177
  cy.findByTestId('minimap-interaction').realMouseWheel({ deltaY: 20 });
178
178
 
@@ -186,7 +186,7 @@ describe('Zoom', () => {
186
186
  it('moves the view when the mouse is hover the content with the corresponding button pressed down', () => {
187
187
  initialize({ showMinimap: true });
188
188
 
189
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
189
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
190
190
  cy.get('svg').should('have.attr', 'height', '400');
191
191
 
192
192
  cy.findByTestId('zoom-container')
@@ -205,7 +205,7 @@ describe('Zoom', () => {
205
205
  it('displays the minimap in the bottom right when the prop to the corresponding value', () => {
206
206
  initialize({ minimapPosition: 'bottom-right', showMinimap: true });
207
207
 
208
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
208
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
209
209
  cy.get('svg').should('have.attr', 'height', '400');
210
210
 
211
211
  cy.makeSnapshot();
@@ -214,7 +214,7 @@ describe('Zoom', () => {
214
214
  it('applies a scale down on the minimap when the content is higher than the original height', () => {
215
215
  initialize({ showMinimap: true, template: ContentWithMultipleShapes });
216
216
 
217
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
217
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
218
218
  cy.get('svg').should('have.attr', 'height', '400');
219
219
 
220
220
  cy.findByTestId('minimap-interaction')
@@ -232,7 +232,7 @@ describe('Zoom', () => {
232
232
  template: ContentWithMultipleShapesWithNegativeTranslations
233
233
  });
234
234
 
235
- cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
235
+ cy.get('g[clip-path="url(#zoom-clip)"]').should('be.visible');
236
236
  cy.get('svg').should('have.attr', 'height', '400');
237
237
 
238
238
  cy.findByTestId('minimap-interaction')
@@ -7,7 +7,6 @@ import { MinimapPosition } from './models';
7
7
 
8
8
  export interface ZoomProps {
9
9
  children: JSX.Element | (({ width, height }) => JSX.Element);
10
- id?: number | string;
11
10
  minimapPosition?: MinimapPosition;
12
11
  scaleMax?: number;
13
12
  scaleMin?: number;
@@ -28,8 +27,7 @@ const Zoom = ({
28
27
  scaleMin = 0.5,
29
28
  scaleMax = 4,
30
29
  showMinimap = false,
31
- minimapPosition = 'top-left',
32
- id = 0
30
+ minimapPosition = 'top-left'
33
31
  }: ZoomProps): JSX.Element => {
34
32
  return (
35
33
  <ParentSize>
@@ -46,7 +44,6 @@ const Zoom = ({
46
44
  {(zoom) => (
47
45
  <ZoomContent
48
46
  height={height}
49
- id={id}
50
47
  minimapPosition={minimapPosition}
51
48
  showMinimap={showMinimap}
52
49
  width={width}
@@ -18,7 +18,6 @@ import { ChildrenProps, MinimapPosition, ZoomState } from './models';
18
18
  export interface Props {
19
19
  children: ({ width, height, transformMatrix }: ChildrenProps) => JSX.Element;
20
20
  height: number;
21
- id?: number | string;
22
21
  minimapPosition: MinimapPosition;
23
22
  showMinimap?: boolean;
24
23
  width: number;
@@ -31,8 +30,7 @@ const ZoomContent = ({
31
30
  height,
32
31
  children,
33
32
  showMinimap,
34
- minimapPosition,
35
- id
33
+ minimapPosition
36
34
  }: Props): JSX.Element => {
37
35
  const { classes } = useZoomStyles();
38
36
  const contentRef = useRef<SVGGElement | null>(null);
@@ -94,7 +92,7 @@ const ZoomContent = ({
94
92
  >
95
93
  <RectClipPath
96
94
  height={Math.max(contentClientRect?.height || 0, height)}
97
- id={`zoom-clip-${id}`}
95
+ id="zoom-clip"
98
96
  rx={radius}
99
97
  width={Math.max(contentClientRect?.width || 0, width)}
100
98
  />
@@ -126,7 +124,6 @@ const ZoomContent = ({
126
124
  diffBetweenContentAndSvg || { left: 0, top: 0 }
127
125
  }
128
126
  height={height}
129
- id={id}
130
127
  isDraggingFromContainer={isDragging}
131
128
  width={width}
132
129
  zoom={zoom}
@@ -12,4 +12,3 @@ export * from './Avatar';
12
12
  export * from './CollapsibleItem';
13
13
  export * from './Inputs';
14
14
  export { default as Zoom } from './Zoom/Zoom';
15
- export * from './Tabs';
package/src/index.ts CHANGED
@@ -131,7 +131,7 @@ export {
131
131
  default as useGraphQuery,
132
132
  resourceTypeQueryParameter
133
133
  } from './api/useGraphQuery';
134
- export { default as QueryProvider, client } from './api/QueryProvider';
134
+ export { default as QueryProvider } from './api/QueryProvider';
135
135
  export {
136
136
  default as FileDropZone,
137
137
  transformFileListToArray
@@ -22,4 +22,3 @@ export * from './centreonBaseURL';
22
22
  export * from './usePluralizedTranslation';
23
23
  export * from './useResizeObserver';
24
24
  export * from './useFullscreen';
25
- export * from './resourcesStatusURL';
@@ -1,11 +1,5 @@
1
- import { useCallback } from 'react';
2
-
3
1
  import { useTranslation } from 'react-i18next';
4
2
  import pluralize from 'pluralize';
5
- import { useAtomValue } from 'jotai';
6
- import { equals, includes } from 'ramda';
7
-
8
- import { userAtom } from '@centreon/ui-context';
9
3
 
10
4
  interface TProps {
11
5
  count: number;
@@ -16,21 +10,10 @@ export const usePluralizedTranslation = (): {
16
10
  pluralizedT: (props: TProps) => string;
17
11
  } => {
18
12
  const translation = useTranslation();
19
- const { locale } = useAtomValue(userAtom);
20
-
21
- const isNotPartitiveLocale = includes('fr', locale);
22
13
 
23
- const pluralizedT = useCallback(
24
- ({ label, count }: TProps): string => {
25
- const isZero = equals(count, 0);
26
-
27
- return pluralize(
28
- translation.t(label),
29
- isZero && isNotPartitiveLocale ? 1 : count
30
- );
31
- },
32
- [isNotPartitiveLocale]
33
- );
14
+ const pluralizedT = ({ label, count }: TProps): string => {
15
+ return pluralize(translation.t(label), count);
16
+ };
34
17
 
35
18
  return {
36
19
  pluralizedT
@@ -1,68 +0,0 @@
1
- import { Typography } from '@mui/material';
2
-
3
- import { DashboardLayout } from '.';
4
-
5
- const dashboardLayout: Array<CustomLayout> = [
6
- {
7
- content: 'Panel 1',
8
- h: 4,
9
- i: 'a',
10
- shouldUseFluidTypography: false,
11
- w: 6,
12
- x: 0,
13
- y: 0
14
- },
15
- {
16
- content: 'Panel 2',
17
- h: 3,
18
- i: 'b',
19
- minW: 2,
20
- w: 7,
21
- x: 1,
22
- y: 7
23
- },
24
- {
25
- content: 'Panel 3',
26
- h: 7,
27
- i: 'c',
28
- w: 6,
29
- x: 6,
30
- y: 6
31
- },
32
- {
33
- content: 'Panel 4',
34
- h: 3,
35
- i: 'd',
36
- minW: 2,
37
- w: 5,
38
- x: 4,
39
- y: 10
40
- }
41
- ];
42
-
43
- const initialize = (): void => {
44
- cy.mount({
45
- Component: (
46
- <DashboardLayout.Layout layout={dashboardLayout}>
47
- {dashboardLayout.map(({ i, content }) => (
48
- <DashboardLayout.Item header={<div>header</div>} id={i} key={i}>
49
- <Typography>{content}</Typography>
50
- </DashboardLayout.Item>
51
- ))}
52
- </DashboardLayout.Layout>
53
- )
54
- });
55
- };
56
-
57
- describe('Dashboard', () => {
58
- it('displays placeholder when panels is out of viewport', () => {
59
- initialize();
60
-
61
- cy.get('[data-widget-skeleton="a"]').should('not.exist');
62
- cy.get('[data-widget-skeleton="b"]').should('not.exist');
63
- cy.get('[data-widget-skeleton="c"]').should('not.exist');
64
- cy.get('[data-widget-skeleton="d"]').should('exist');
65
-
66
- cy.makeSnapshot();
67
- });
68
- });