@centreon/ui 24.5.2 → 24.5.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.
Files changed (58) hide show
  1. package/package.json +8 -4
  2. package/public/mockServiceWorker.js +81 -100
  3. package/src/ActionsList/index.stories.tsx +7 -1
  4. package/src/Dashboard/Dashboard.styles.ts +3 -2
  5. package/src/Dashboard/Item.tsx +11 -2
  6. package/src/Dashboard/Layout.tsx +4 -2
  7. package/src/Graph/BarStack/BarStack.stories.tsx +8 -6
  8. package/src/Graph/BarStack/ResponsiveBarStack.tsx +3 -3
  9. package/src/Graph/HeatMap/HeatMap.stories.tsx +20 -0
  10. package/src/Graph/LineChart/index.stories.tsx +1 -1
  11. package/src/Graph/PieChart/PieChart.stories.tsx +11 -15
  12. package/src/Graph/PieChart/ResponsivePie.tsx +1 -1
  13. package/src/Graph/Tree/DescendantNodes.tsx +1 -0
  14. package/src/Graph/Tree/Links.tsx +15 -2
  15. package/src/Graph/Tree/Tree.cypress.spec.tsx +24 -0
  16. package/src/Graph/Tree/Tree.stories.tsx +17 -1
  17. package/src/Graph/Tree/models.ts +3 -0
  18. package/src/TimePeriods/index.stories.tsx +7 -12
  19. package/src/TopCounterElements/TopCounterLayout.tsx +3 -4
  20. package/src/TopCounterElements/useCloseOnLegacyPage.tsx +9 -6
  21. package/src/api/QueryProvider.tsx +1 -1
  22. package/src/api/logger.ts +11 -0
  23. package/src/api/useFetchQuery/index.test.ts +0 -5
  24. package/src/api/useFetchQuery/index.ts +2 -5
  25. package/src/api/useGraphQuery/index.ts +7 -1
  26. package/src/api/useMutationQuery/index.ts +2 -5
  27. package/src/api/useRequest/index.test.ts +0 -3
  28. package/src/api/useRequest/index.ts +3 -6
  29. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +27 -13
  30. package/src/components/Form/AccessRights/AccessRights.stories.tsx +0 -19
  31. package/src/components/Form/AccessRights/AccessRights.styles.ts +1 -1
  32. package/src/components/Form/AccessRights/AccessRights.tsx +6 -5
  33. package/src/components/Form/AccessRights/Actions/Actions.styles.ts +3 -7
  34. package/src/components/Form/AccessRights/Actions/Actions.tsx +15 -32
  35. package/src/components/Form/AccessRights/Actions/useActions.ts +4 -37
  36. package/src/components/Form/AccessRights/models.ts +0 -3
  37. package/src/components/Form/AccessRights/storiesData.ts +0 -3
  38. package/src/components/Form/AccessRights/useAccessRightsChange.ts +30 -0
  39. package/src/components/Form/AccessRights/utils.ts +18 -0
  40. package/src/components/Form/Dashboard/translatedLabels.ts +0 -1
  41. package/src/components/List/Item/ListItem.styles.ts +2 -2
  42. package/src/components/Tabs/Tab.styles.ts +25 -0
  43. package/src/components/Tabs/TabPanel.tsx +22 -0
  44. package/src/components/Tabs/Tabs.cypress.spec.tsx +70 -0
  45. package/src/components/Tabs/Tabs.stories.tsx +55 -0
  46. package/src/components/Tabs/Tabs.tsx +55 -0
  47. package/src/components/Tabs/index.ts +6 -0
  48. package/src/components/Zoom/Minimap.tsx +4 -2
  49. package/src/components/Zoom/Zoom.cypress.spec.tsx +13 -13
  50. package/src/components/Zoom/Zoom.tsx +4 -1
  51. package/src/components/Zoom/ZoomContent.tsx +5 -2
  52. package/src/components/index.ts +1 -0
  53. package/src/index.ts +1 -1
  54. package/src/utils/index.ts +1 -0
  55. package/src/utils/resourcesStatusURL.ts +166 -0
  56. package/src/utils/usePluralizedTranslation.test.ts +159 -0
  57. package/src/utils/usePluralizedTranslation.ts +20 -3
  58. package/src/components/Form/Dashboard/DashboardForm.stories.ts +0 -39
@@ -1,64 +1,32 @@
1
1
  import { useAtomValue } from 'jotai';
2
- import { equals, omit } from 'ramda';
2
+ import { equals } from 'ramda';
3
3
 
4
4
  import { initialValuesAtom, valuesAtom } from '../atoms';
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
- };
5
+ import { AccessRightInitialValues, Labels } from '../models';
6
+ import { formatValue, formatValueForSubmition } from '../utils';
20
7
 
21
8
  interface Props {
22
9
  clear: () => void;
23
10
  labels: Labels['actions'];
24
- link?: string;
25
11
  submit: (values: Array<AccessRightInitialValues>) => Promise<void>;
26
12
  }
27
13
 
28
14
  interface UseActionsState {
29
- copyLink: () => void;
30
15
  dirty: boolean;
31
16
  formattedValues: Array<AccessRightInitialValues>;
32
17
  save: () => void;
33
18
  }
34
19
 
35
- export const useActions = ({
36
- link,
37
- labels,
38
- submit,
39
- clear
40
- }: Props): UseActionsState => {
20
+ export const useActions = ({ submit, clear }: Props): UseActionsState => {
41
21
  const values = useAtomValue(valuesAtom);
42
22
  const initialValues = useAtomValue(initialValuesAtom);
43
23
 
44
- const { copy } = useCopyToClipboard({
45
- errorMessage: labels.copyError,
46
- successMessage: labels.copySuccess
47
- });
48
-
49
24
  const formattedValues = values
50
25
  .filter(({ isRemoved }) => !isRemoved)
51
26
  .map(formatValue);
52
27
 
53
28
  const dirty = !equals(initialValues, formattedValues);
54
29
 
55
- const copyLink = (): void => {
56
- if (!link) {
57
- return;
58
- }
59
- copy(link);
60
- };
61
-
62
30
  const save = (): void => {
63
31
  submit(
64
32
  values.filter(({ isRemoved }) => !isRemoved).map(formatValueForSubmition)
@@ -71,7 +39,6 @@ export const useActions = ({
71
39
  };
72
40
 
73
41
  return {
74
- copyLink,
75
42
  dirty,
76
43
  formattedValues,
77
44
  save
@@ -16,9 +16,6 @@ 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;
22
19
  save: string;
23
20
  };
24
21
  add: {
@@ -105,9 +105,6 @@ 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',
111
108
  save: 'Save'
112
109
  },
113
110
  add: {
@@ -0,0 +1,30 @@
1
+ import { useEffect } from 'react';
2
+
3
+ import { useAtomValue } from 'jotai';
4
+
5
+ import { useDeepCompare } from '../../../utils';
6
+
7
+ import { valuesAtom } from './atoms';
8
+ import { formatValueForSubmition } from './utils';
9
+ import { AccessRightInitialValues } from './models';
10
+
11
+ export const useAccessRightsChange = (
12
+ onChange?: (values: Array<AccessRightInitialValues>) => void
13
+ ): void => {
14
+ const values = useAtomValue(valuesAtom);
15
+
16
+ useEffect(
17
+ () => {
18
+ if (!onChange) {
19
+ return;
20
+ }
21
+
22
+ onChange(
23
+ values
24
+ .filter(({ isRemoved }) => !isRemoved)
25
+ .map(formatValueForSubmition)
26
+ );
27
+ },
28
+ useDeepCompare([values])
29
+ );
30
+ };
@@ -0,0 +1,18 @@
1
+ import { omit } from 'ramda';
2
+
3
+ import { AccessRight, AccessRightInitialValues } from './models';
4
+
5
+ export const formatValue = (
6
+ accessRight: AccessRight
7
+ ): AccessRightInitialValues => {
8
+ return omit(['isAdded', 'isUpdated', 'isRemoved'], accessRight);
9
+ };
10
+
11
+ export const formatValueForSubmition = (
12
+ accessRight: AccessRight
13
+ ): AccessRightInitialValues => {
14
+ return {
15
+ ...formatValue(accessRight),
16
+ id: Number((accessRight.id as string).split('_')[1])
17
+ };
18
+ };
@@ -1,4 +1,3 @@
1
- // TODO use i18n conventions for translation (interpolation, plurals, etc.) and setup for storybook (only works in FE atm.)
2
1
  export const labelMustBeMost = '{{label}} can be at most {{max}} characters';
3
2
  export const labelMustBeAtLeast =
4
3
  '{{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',
22
21
  overflow: 'hidden',
23
22
  paddingBottom: theme.spacing(1),
24
- paddingTop: theme.spacing(1)
23
+ paddingTop: theme.spacing(1),
24
+ width: '100%'
25
25
  },
26
26
  secondary: {
27
27
  alignItems: 'center',
@@ -0,0 +1,25 @@
1
+ import { makeStyles } from 'tss-react/mui';
2
+
3
+ export const useTabsStyles = makeStyles()((theme) => ({
4
+ indicator: {
5
+ bottom: 'unset'
6
+ },
7
+ tab: {
8
+ '&[aria-selected="true"]': {
9
+ color: theme.palette.text.primary,
10
+ fontWeight: theme.typography.fontWeightBold
11
+ },
12
+ color: theme.palette.text.primary,
13
+ fontWeight: theme.typography.fontWeightRegular,
14
+ marginRight: theme.spacing(2),
15
+ minHeight: 0,
16
+ minWidth: 0,
17
+ padding: theme.spacing(0.5, 0)
18
+ },
19
+ tabPanel: {
20
+ padding: theme.spacing(1, 0, 0)
21
+ },
22
+ tabs: {
23
+ minHeight: theme.spacing(4.5)
24
+ }
25
+ }));
@@ -0,0 +1,22 @@
1
+ import { TabPanel as MuiTabPanel } from '@mui/lab';
2
+
3
+ import { useTabsStyles } from './Tab.styles';
4
+
5
+ type Props = {
6
+ children: JSX.Element;
7
+ value: string;
8
+ };
9
+
10
+ export const TabPanel = ({ children, value }: Props): JSX.Element => {
11
+ const { classes } = useTabsStyles();
12
+
13
+ return (
14
+ <MuiTabPanel
15
+ className={classes.tabPanel}
16
+ data-tabPanel={value}
17
+ value={value}
18
+ >
19
+ {children}
20
+ </MuiTabPanel>
21
+ );
22
+ };
@@ -0,0 +1,70 @@
1
+ import { Typography } from '@mui/material';
2
+
3
+ import { TabPanel } from './TabPanel';
4
+
5
+ import { Tabs } from '.';
6
+
7
+ const initialize = (withTabListProps = false): void => {
8
+ cy.mount({
9
+ Component: (
10
+ <Tabs
11
+ defaultTab="tab 0"
12
+ tabList={
13
+ withTabListProps
14
+ ? {
15
+ variant: 'fullWidth'
16
+ }
17
+ : undefined
18
+ }
19
+ tabs={[
20
+ { label: 'Tab 0', value: 'tab 0' },
21
+ { label: 'Tab 1', value: 'tab 1' }
22
+ ]}
23
+ >
24
+ <TabPanel value="tab 0">
25
+ <Typography>Tab 0</Typography>
26
+ </TabPanel>
27
+ <TabPanel value="tab 1">
28
+ <Typography>Tab 1</Typography>
29
+ </TabPanel>
30
+ </Tabs>
31
+ )
32
+ });
33
+ };
34
+
35
+ describe('Tabs', () => {
36
+ it('displays tabs and their content when a tab is selected', () => {
37
+ initialize();
38
+
39
+ cy.get('[data-TabPanel="tab 0"]').should('not.have.attr', 'hidden');
40
+ cy.get('[data-TabPanel="tab 1"]').should('have.attr', 'hidden');
41
+ cy.findByLabelText('Tab 0')
42
+ .should('have.attr', 'aria-selected')
43
+ .and('equals', 'true');
44
+ cy.findByLabelText('Tab 1')
45
+ .should('have.attr', 'aria-selected')
46
+ .and('equals', 'false');
47
+
48
+ cy.contains('Tab 1').click();
49
+
50
+ cy.get('[data-TabPanel="tab 0"]').should('have.attr', 'hidden');
51
+ cy.get('[data-TabPanel="tab 1"]').should('not.have.attr', 'hidden');
52
+ cy.findByLabelText('Tab 0')
53
+ .should('have.attr', 'aria-selected')
54
+ .and('equals', 'false');
55
+ cy.findByLabelText('Tab 1')
56
+ .should('have.attr', 'aria-selected')
57
+ .and('equals', 'true');
58
+
59
+ cy.makeSnapshot();
60
+ });
61
+
62
+ it('displays tabs when tabList props are set', () => {
63
+ initialize(true);
64
+
65
+ cy.get('[data-TabPanel="tab 0"]').should('not.have.attr', 'hidden');
66
+ cy.get('[data-TabPanel="tab 1"]').should('have.attr', 'hidden');
67
+
68
+ cy.makeSnapshot();
69
+ });
70
+ });
@@ -0,0 +1,55 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Typography } from '@mui/material';
4
+
5
+ import { TabPanel } from './TabPanel';
6
+
7
+ import { Tabs } from '.';
8
+
9
+ const meta: Meta<typeof Tabs> = {
10
+ component: Tabs
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof Tabs>;
15
+
16
+ const generateTabs = (size: number): Array<{ label: string; value: string }> =>
17
+ Array(size)
18
+ .fill(0)
19
+ .map((_, index) => ({ label: `Tab ${index}`, value: `tab ${index}` }));
20
+
21
+ export const Default: Story = {
22
+ args: {
23
+ defaultTab: 'tab 0',
24
+ tabs: generateTabs(2)
25
+ },
26
+ render: (args) => (
27
+ <Tabs {...args}>
28
+ {generateTabs(2).map(({ value, label }) => (
29
+ <TabPanel key={value} value={value}>
30
+ <Typography>{label}</Typography>
31
+ </TabPanel>
32
+ ))}
33
+ </Tabs>
34
+ )
35
+ };
36
+
37
+ export const WithTabListProps: Story = {
38
+ args: {
39
+ defaultTab: 'tab 0',
40
+ tabList: {
41
+ textColor: 'inherit',
42
+ variant: 'fullWidth'
43
+ },
44
+ tabs: generateTabs(2)
45
+ },
46
+ render: (args) => (
47
+ <Tabs {...args}>
48
+ {generateTabs(2).map(({ value, label }) => (
49
+ <TabPanel key={value} value={value}>
50
+ <Typography>{label}</Typography>
51
+ </TabPanel>
52
+ ))}
53
+ </Tabs>
54
+ )
55
+ };
@@ -0,0 +1,55 @@
1
+ import { useCallback, useState } from 'react';
2
+
3
+ import { TabContext, TabList, TabListProps } from '@mui/lab';
4
+ import { Tab } from '@mui/material';
5
+
6
+ import { useTabsStyles } from './Tab.styles';
7
+
8
+ type Props = {
9
+ children: Array<JSX.Element>;
10
+ defaultTab: string;
11
+ tabList?: TabListProps;
12
+ tabs: Array<{
13
+ label: string;
14
+ value: string;
15
+ }>;
16
+ };
17
+
18
+ export const Tabs = ({
19
+ children,
20
+ defaultTab,
21
+ tabs,
22
+ tabList
23
+ }: Props): JSX.Element => {
24
+ const { classes } = useTabsStyles();
25
+
26
+ const [selectedTab, setSelectedTab] = useState(defaultTab);
27
+
28
+ const changeTab = useCallback((_, newValue: string): void => {
29
+ setSelectedTab(newValue);
30
+ }, []);
31
+
32
+ return (
33
+ <TabContext value={selectedTab}>
34
+ <TabList
35
+ classes={{
36
+ indicator: classes.indicator,
37
+ root: classes.tabs
38
+ }}
39
+ onChange={changeTab}
40
+ {...tabList}
41
+ >
42
+ {tabs.map(({ value, label }) => (
43
+ <Tab
44
+ aria-label={label}
45
+ className={classes.tab}
46
+ key={value}
47
+ label={label}
48
+ value={value}
49
+ />
50
+ ))}
51
+ </TabList>
52
+ {children}
53
+ </TabContext>
54
+ );
55
+ };
@@ -0,0 +1,6 @@
1
+ import { TabPanel } from './TabPanel';
2
+ import { Tabs as TabsRoot } from './Tabs';
3
+
4
+ export const Tabs = Object.assign(TabsRoot, {
5
+ TabPanel
6
+ });
@@ -16,6 +16,7 @@ interface Props extends Omit<UseMinimapProps, 'minimapScale' | 'scale'> {
16
16
  left: number;
17
17
  top: number;
18
18
  };
19
+ id?: number | string;
19
20
  isDraggingFromContainer: boolean;
20
21
  }
21
22
 
@@ -26,7 +27,8 @@ const Minimap = ({
26
27
  width,
27
28
  contentClientRect,
28
29
  isDraggingFromContainer,
29
- diffBetweenContentAndSvg
30
+ diffBetweenContentAndSvg,
31
+ id
30
32
  }: Props): JSX.Element => {
31
33
  const { classes } = useZoomStyles();
32
34
 
@@ -82,7 +84,7 @@ const Minimap = ({
82
84
  );
83
85
 
84
86
  return (
85
- <g className={classes.minimap} clipPath="url(#zoom-clip)">
87
+ <g className={classes.minimap} clipPath={`url(#zoom-clip-${id})`}>
86
88
  <rect
87
89
  className={classes.minimapBackground}
88
90
  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)"]').should('be.visible');
66
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
75
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
89
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
104
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
119
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
134
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('not.exist');
153
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
161
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
175
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
189
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
208
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
217
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').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)"]').should('be.visible');
235
+ cy.get('g[clip-path="url(#zoom-clip-0)"]').should('be.visible');
236
236
  cy.get('svg').should('have.attr', 'height', '400');
237
237
 
238
238
  cy.findByTestId('minimap-interaction')
@@ -7,6 +7,7 @@ import { MinimapPosition } from './models';
7
7
 
8
8
  export interface ZoomProps {
9
9
  children: JSX.Element | (({ width, height }) => JSX.Element);
10
+ id?: number | string;
10
11
  minimapPosition?: MinimapPosition;
11
12
  scaleMax?: number;
12
13
  scaleMin?: number;
@@ -27,7 +28,8 @@ const Zoom = ({
27
28
  scaleMin = 0.5,
28
29
  scaleMax = 4,
29
30
  showMinimap = false,
30
- minimapPosition = 'top-left'
31
+ minimapPosition = 'top-left',
32
+ id = 0
31
33
  }: ZoomProps): JSX.Element => {
32
34
  return (
33
35
  <ParentSize>
@@ -44,6 +46,7 @@ const Zoom = ({
44
46
  {(zoom) => (
45
47
  <ZoomContent
46
48
  height={height}
49
+ id={id}
47
50
  minimapPosition={minimapPosition}
48
51
  showMinimap={showMinimap}
49
52
  width={width}
@@ -18,6 +18,7 @@ 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;
21
22
  minimapPosition: MinimapPosition;
22
23
  showMinimap?: boolean;
23
24
  width: number;
@@ -30,7 +31,8 @@ const ZoomContent = ({
30
31
  height,
31
32
  children,
32
33
  showMinimap,
33
- minimapPosition
34
+ minimapPosition,
35
+ id
34
36
  }: Props): JSX.Element => {
35
37
  const { classes } = useZoomStyles();
36
38
  const contentRef = useRef<SVGGElement | null>(null);
@@ -92,7 +94,7 @@ const ZoomContent = ({
92
94
  >
93
95
  <RectClipPath
94
96
  height={Math.max(contentClientRect?.height || 0, height)}
95
- id="zoom-clip"
97
+ id={`zoom-clip-${id}`}
96
98
  rx={radius}
97
99
  width={Math.max(contentClientRect?.width || 0, width)}
98
100
  />
@@ -124,6 +126,7 @@ const ZoomContent = ({
124
126
  diffBetweenContentAndSvg || { left: 0, top: 0 }
125
127
  }
126
128
  height={height}
129
+ id={id}
127
130
  isDraggingFromContainer={isDragging}
128
131
  width={width}
129
132
  zoom={zoom}
@@ -12,3 +12,4 @@ 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 } from './api/QueryProvider';
134
+ export { default as QueryProvider, client } from './api/QueryProvider';
135
135
  export {
136
136
  default as FileDropZone,
137
137
  transformFileListToArray
@@ -22,3 +22,4 @@ export * from './centreonBaseURL';
22
22
  export * from './usePluralizedTranslation';
23
23
  export * from './useResizeObserver';
24
24
  export * from './useFullscreen';
25
+ export * from './resourcesStatusURL';