@centreon/ui 24.8.2 → 24.8.4

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 (112) hide show
  1. package/package.json +32 -34
  2. package/public/mockServiceWorker.js +1 -1
  3. package/src/Graph/BarChart/BarChart.cypress.spec.tsx +38 -81
  4. package/src/Graph/BarChart/BarChart.tsx +4 -4
  5. package/src/Graph/BarChart/BarGroup.tsx +81 -92
  6. package/src/Graph/BarChart/BarStack.tsx +21 -13
  7. package/src/Graph/BarChart/ResponsiveBarChart.tsx +26 -50
  8. package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +1 -1
  9. package/src/Graph/BarChart/useBarStack.ts +1 -1
  10. package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Point.tsx +1 -1
  11. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +67 -0
  12. package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +4 -7
  13. package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/index.tsx +6 -9
  14. package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/models.ts +1 -2
  15. package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/useScaleThreshold.ts +8 -20
  16. package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/index.tsx +64 -43
  17. package/src/Graph/{LineChart/LineChart.cypress.spec.tsx → Chart/Chart.cypress.spec.tsx} +272 -23
  18. package/src/Graph/{LineChart/index.stories.tsx → Chart/Chart.stories.tsx} +217 -24
  19. package/src/Graph/{LineChart/LineChart.styles.ts → Chart/Chart.styles.ts} +1 -1
  20. package/src/Graph/{LineChart/LineChart.tsx → Chart/Chart.tsx} +84 -100
  21. package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +5 -1
  22. package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +6 -1
  23. package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +61 -0
  24. package/src/Graph/{LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx → Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltipContent.tsx} +2 -2
  25. package/src/Graph/{LineChart → Chart}/InteractiveComponents/index.tsx +11 -15
  26. package/src/Graph/{LineChart → Chart}/Legend/Legend.styles.ts +1 -7
  27. package/src/Graph/{LineChart → Chart}/Legend/LegendHeader.tsx +9 -5
  28. package/src/Graph/{LineChart → Chart}/Legend/index.tsx +2 -1
  29. package/src/Graph/Chart/graphAtoms.ts +6 -0
  30. package/src/Graph/{LineChart → Chart}/index.tsx +10 -7
  31. package/src/Graph/{LineChart → Chart}/models.ts +8 -3
  32. package/src/Graph/common/Axes/AxisStyles.ts +11 -0
  33. package/src/Graph/common/Axes/UnitLabel.tsx +41 -10
  34. package/src/Graph/common/Axes/index.tsx +18 -12
  35. package/src/Graph/common/Axes/models.ts +4 -2
  36. package/src/Graph/common/Axes/useAxisY.ts +22 -12
  37. package/src/Graph/common/BaseChart/BaseChart.tsx +2 -2
  38. package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +8 -5
  39. package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +1 -1
  40. package/src/Graph/common/Grids/index.tsx +2 -2
  41. package/src/Graph/common/Thresholds/ThresholdLine.tsx +1 -1
  42. package/src/Graph/common/Thresholds/Thresholds.tsx +10 -15
  43. package/src/Graph/common/timeSeries/index.ts +109 -131
  44. package/src/Graph/common/timeSeries/models.ts +4 -5
  45. package/src/Graph/index.ts +4 -4
  46. package/src/Graph/mockedData/lastDayWithLotOfUnits.json +1668 -0
  47. package/src/Graph/mockedData/pingService.json +46 -1
  48. package/src/Graph/mockedData/pingServiceLinesBars.json +253 -0
  49. package/src/Graph/mockedData/pingServiceLinesBarsMixed.json +253 -0
  50. package/src/Graph/mockedData/pingServiceLinesBarsStacked.json +253 -0
  51. package/src/Graph/mockedData/pingServiceMixedStacked.json +46 -1
  52. package/src/Graph/mockedData/pingServiceStacked.json +46 -1
  53. package/src/Typography/EllipsisTypography.tsx +5 -2
  54. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +16 -24
  55. package/src/components/Form/AccessRights/AccessRights.stories.tsx +5 -5
  56. package/src/components/Form/AccessRights/AccessRights.tsx +3 -3
  57. package/src/components/Form/index.ts +2 -2
  58. package/src/utils/index.ts +2 -2
  59. package/src/Graph/BarChart/SingleBar.tsx +0 -62
  60. package/src/Graph/BarChart/useSingleBar.ts +0 -199
  61. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/useStackedLines.ts +0 -39
  62. package/src/Graph/LineChart/graphAtoms.ts +0 -3
  63. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/RegularLines/index.tsx +0 -0
  64. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/RegularLines/useRegularLines.ts +0 -0
  65. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/StackedLines/index.tsx +0 -0
  66. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/BasicThreshold.tsx +0 -0
  67. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/Circle.tsx +0 -0
  68. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +0 -0
  69. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/helpers/index.ts +0 -0
  70. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/Threshold/useCoordinateCircle.ts +0 -0
  71. /package/src/Graph/{LineChart → Chart}/BasicComponents/Lines/models.ts +0 -0
  72. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/GuidingLines.tsx +0 -0
  73. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/index.tsx +0 -0
  74. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/models.ts +0 -0
  75. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/AnchorPoint/useTickGraph.ts +0 -0
  76. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Annotation/Area.tsx +0 -0
  77. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Annotation/Line.tsx +0 -0
  78. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Annotation/index.tsx +0 -0
  79. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Area/Downtime.tsx +0 -0
  80. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/EventAnnotations.tsx +0 -0
  81. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Line/Acknowledgement.tsx +0 -0
  82. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/Line/Comments.tsx +0 -0
  83. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/annotationsAtoms.ts +0 -0
  84. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/index.tsx +0 -0
  85. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/models.ts +0 -0
  86. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Annotations/useAnnotation.ts +0 -0
  87. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Bar.tsx +0 -0
  88. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +0 -0
  89. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +0 -0
  90. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/TimeShiftIcon.tsx +0 -0
  91. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +0 -0
  92. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/index.tsx +0 -0
  93. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/models.ts +0 -0
  94. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/TimeShiftZones/useTimeShiftZones.ts +0 -0
  95. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Tooltip/index.tsx +0 -0
  96. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Tooltip/models.ts +0 -0
  97. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/Tooltip/useGraphTooltip.ts +0 -0
  98. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/index.tsx +0 -0
  99. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/models.ts +0 -0
  100. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/useZoomPreview.ts +0 -0
  101. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/ZoomPreview/zoomPreviewAtoms.ts +0 -0
  102. /package/src/Graph/{LineChart → Chart}/InteractiveComponents/interactionWithGraphAtoms.ts +0 -0
  103. /package/src/Graph/{LineChart → Chart}/Legend/LegendContent.tsx +0 -0
  104. /package/src/Graph/{LineChart → Chart}/Legend/models.ts +0 -0
  105. /package/src/Graph/{LineChart → Chart}/Legend/useLegend.ts +0 -0
  106. /package/src/Graph/{LineChart → Chart}/LoadingSkeleton.tsx +0 -0
  107. /package/src/Graph/{LineChart → Chart}/common/index.ts +0 -0
  108. /package/src/Graph/{LineChart → Chart}/helpers/doc.ts +0 -0
  109. /package/src/Graph/{LineChart → Chart}/helpers/index.ts +0 -0
  110. /package/src/Graph/{LineChart → Chart}/translatedLabels.ts +0 -0
  111. /package/src/Graph/{LineChart/useLineChartData.ts → Chart/useChartData.ts} +0 -0
  112. /package/src/Graph/{LineChart/useLineChartIntersection.ts → Chart/useChartIntersection.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.8.2",
3
+ "version": "24.8.4",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -12,7 +12,7 @@
12
12
  "test:storybook:local": "test-storybook --url http://127.0.0.1:9001",
13
13
  "test:ci": "jest --silent --reporter=jest-junit",
14
14
  "cypress:ui": "cypress open --component --browser=chrome",
15
- "cypress:run:updateSnapshot": "cypress run --component --browser=electron --env updateSnapshots=true",
15
+ "cypress:run:updateSnapshots": "cypress run --component --browser=chrome --env updateSnapshots=true",
16
16
  "cypress:run:coverage": "cypress run --component --browser=chrome --env codeCoverageTasksRegistered=true",
17
17
  "cypress:run": "cypress run --component --browser=chrome",
18
18
  "tokens:transform": "TS_NODE_PROJECT=tsconfig.node.json ts-node style-dictionary.transform.ts"
@@ -49,28 +49,28 @@
49
49
  ],
50
50
  "devDependencies": {
51
51
  "@cypress/react": "^8.0.2",
52
- "@cypress/webpack-dev-server": "^3.10.0",
52
+ "@cypress/webpack-dev-server": "^3.10.1",
53
53
  "@faker-js/faker": "^8.4.1",
54
54
  "@mdx-js/react": "^3.0.1",
55
- "@modern-js/prod-server": "^2.56.0",
56
- "@modern-js/storybook": "^2.56.0",
55
+ "@modern-js/prod-server": "^2.58.1",
56
+ "@modern-js/storybook": "^2.58.1",
57
57
  "@simonsmith/cypress-image-snapshot": "^9.1.0",
58
- "@storybook/addon-a11y": "^8.2.5",
59
- "@storybook/addon-docs": "^8.2.5",
60
- "@storybook/addon-essentials": "^8.2.5",
61
- "@storybook/addon-interactions": "^8.2.5",
62
- "@storybook/addon-themes": "^8.2.5",
63
- "@storybook/blocks": "^8.2.5",
64
- "@storybook/manager-api": "^8.2.5",
58
+ "@storybook/addon-a11y": "^8.2.9",
59
+ "@storybook/addon-docs": "^8.2.9",
60
+ "@storybook/addon-essentials": "^8.2.9",
61
+ "@storybook/addon-interactions": "^8.2.9",
62
+ "@storybook/addon-themes": "^8.2.9",
63
+ "@storybook/blocks": "^8.2.9",
64
+ "@storybook/manager-api": "^8.2.9",
65
65
  "@storybook/mdx2-csf": "^1.1.0",
66
- "@storybook/preview-api": "^8.2.5",
67
- "@storybook/react": "^8.2.5",
68
- "@storybook/react-vite": "^8.2.5",
69
- "@storybook/test": "^8.2.5",
66
+ "@storybook/preview-api": "^8.2.9",
67
+ "@storybook/react": "^8.2.9",
68
+ "@storybook/react-vite": "^8.2.9",
69
+ "@storybook/test": "^8.2.9",
70
70
  "@storybook/test-runner": "^0.19.1",
71
- "@storybook/theming": "^8.2.5",
71
+ "@storybook/theming": "^8.2.9",
72
72
  "@testing-library/cypress": "^10.0.2",
73
- "@testing-library/jest-dom": "^6.4.6",
73
+ "@testing-library/jest-dom": "^6.4.8",
74
74
  "@testing-library/react": "^16.0.0",
75
75
  "@testing-library/react-hooks": "^8.0.1",
76
76
  "@types/jest": "^29.5.12",
@@ -80,27 +80,25 @@
80
80
  "@types/testing-library__jest-dom": "^6.0.0",
81
81
  "@vitejs/plugin-react": "^4.3.1",
82
82
  "@vitejs/plugin-react-swc": "^3.7.0",
83
- "axios-mock-adapter": "^1.22.0",
84
83
  "chai": "^5.1.1",
85
- "cypress": "^13.13.1",
84
+ "cypress": "^13.13.3",
86
85
  "identity-obj-proxy": "^3.0.0",
87
86
  "jest-transform-stub": "^2.0.0",
88
87
  "mochawesome": "^7.1.3",
89
- "msw": "2.3.2",
88
+ "msw": "2.3.5",
90
89
  "msw-storybook-addon": "^2.0.3",
91
- "puppeteer": "^22.13.1",
92
90
  "react": "^18.3.1",
93
91
  "react-dom": "^18.3.1",
94
92
  "react-test-renderer": "^18.3.1",
95
93
  "remark-gfm": "^4.0.0",
96
94
  "speed-measure-vite-plugin": "^1.0.1",
97
- "storybook": "^8.2.5",
95
+ "storybook": "^8.2.9",
98
96
  "storybook-addon-mock": "^5.0.0",
99
97
  "storybook-dark-mode": "^4.0.2",
100
98
  "style-dictionary": "^4.0.1",
101
99
  "ts-node": "^10.9.2",
102
100
  "use-resize-observer": "^9.1.0",
103
- "vite": "^5.3.4",
101
+ "vite": "^5.4.1",
104
102
  "vite-plugin-istanbul": "^6.0.2",
105
103
  "vite-plugin-svgr": "^4.2.0",
106
104
  "vite-plugin-turbosnap": "^1.0.3"
@@ -109,14 +107,14 @@
109
107
  "@centreon/ui-context": "file:../ui-context"
110
108
  },
111
109
  "dependencies": {
112
- "@lexical/html": "^0.16.1",
113
- "@lexical/link": "^0.16.1",
114
- "@lexical/list": "^0.16.1",
115
- "@lexical/react": "^0.16.1",
116
- "@lexical/rich-text": "^0.16.1",
117
- "@lexical/selection": "^0.16.1",
118
- "@lexical/utils": "^0.16.1",
119
- "@mui/material": "^5.16.4",
110
+ "@lexical/html": "^0.17.0",
111
+ "@lexical/link": "^0.17.0",
112
+ "@lexical/list": "^0.17.0",
113
+ "@lexical/react": "^0.17.0",
114
+ "@lexical/rich-text": "^0.17.0",
115
+ "@lexical/selection": "^0.17.0",
116
+ "@lexical/utils": "^0.17.0",
117
+ "@mui/material": "^5.16.7",
120
118
  "@react-spring/web": "^9.7.4",
121
119
  "@visx/clip-path": "^3.3.0",
122
120
  "@visx/curve": "^3.3.0",
@@ -136,14 +134,14 @@
136
134
  "d3-array": "3.2.4",
137
135
  "dayjs": "^1.11.12",
138
136
  "humanize-duration": "^3.32.1",
139
- "lexical": "^0.16.1",
137
+ "lexical": "^0.17.0",
140
138
  "notistack": "^3.0.1",
141
139
  "numeral": "^2.0.6",
142
140
  "ramda": "0.30.1",
143
141
  "react-grid-layout": "^1.4.4",
144
142
  "react-html-parser": "^2.0.2",
145
143
  "react-resizable": "^3.0.5",
146
- "react-router-dom": "^6.25.1",
144
+ "react-router-dom": "^6.26.1",
147
145
  "react-transition-group": "^4.4.5",
148
146
  "sanitize-html": "^2.13.0",
149
147
  "ulog": "^2.0.0-beta.19"
@@ -8,7 +8,7 @@
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const PACKAGE_VERSION = '2.3.2'
11
+ const PACKAGE_VERSION = '2.3.5'
12
12
  const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
13
13
  const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
14
14
  const activeClientIds = new Set()
@@ -1,7 +1,6 @@
1
1
  import { renderHook } from '@testing-library/react';
2
2
  import dayjs from 'dayjs';
3
3
  import { useAtomValue } from 'jotai';
4
- import { equals } from 'ramda';
5
4
 
6
5
  import { userAtom } from '@centreon/ui-context';
7
6
 
@@ -56,6 +55,21 @@ const initialize = ({
56
55
  cy.viewport('macbook-13');
57
56
  };
58
57
 
58
+ const checkWidth = (orientation): void => {
59
+ if (orientation === 'vertical') {
60
+ cy.get('g[class*="visx-rows"] > line')
61
+ .eq(0)
62
+ .should('have.attr', 'x2')
63
+ .and('equal', '1135');
64
+
65
+ return;
66
+ }
67
+ cy.get('g[class*="visx-rows"] > line')
68
+ .eq(0)
69
+ .should('have.attr', 'x2')
70
+ .and('equal', '1170');
71
+ };
72
+
59
73
  describe('Bar chart', () => {
60
74
  ['horizontal', 'vertical'].forEach((orientation) => {
61
75
  it(`displays the bar chart ${orientation}ly`, () => {
@@ -63,19 +77,12 @@ describe('Bar chart', () => {
63
77
  const userData = renderHook(() => useAtomValue(userAtom));
64
78
  userData.result.current.locale = 'en';
65
79
 
80
+ checkWidth(orientation);
66
81
  cy.contains('0 ms').should('be.visible');
67
82
  cy.contains('20').should('be.visible');
68
83
  cy.contains(':40 AM').should('be.visible');
69
84
 
70
- if (equals(orientation, 'horizontal')) {
71
- cy.findByTestId('single-bar-3-2-0.08644')
72
- .should('have.attr', 'height')
73
- .should('equals', '295');
74
- } else {
75
- cy.findByTestId('single-bar-3-2-0.08644')
76
- .should('have.attr', 'width')
77
- .should('equals', '863');
78
- }
85
+ cy.findByTestId('stacked-bar-3-0-0.08644').should('be.visible');
79
86
 
80
87
  cy.makeSnapshot();
81
88
  });
@@ -83,19 +90,12 @@ describe('Bar chart', () => {
83
90
  it(`displays the bar chart ${orientation}ly centered in zero`, () => {
84
91
  initialize({ axis: { isCenteredZero: true }, orientation });
85
92
 
93
+ checkWidth(orientation);
86
94
  cy.contains('0 ms').should('be.visible');
87
95
  cy.contains('20').should('be.visible');
88
96
  cy.contains(':40 AM').should('be.visible');
89
97
 
90
- if (equals(orientation, 'horizontal')) {
91
- cy.findByTestId('single-bar-3-2-0.08644')
92
- .should('have.attr', 'height')
93
- .should('equals', '171');
94
- } else {
95
- cy.findByTestId('single-bar-3-2-0.08644')
96
- .should('have.attr', 'width')
97
- .should('equals', '432');
98
- }
98
+ cy.findByTestId('stacked-bar-3-0-0.08644').should('be.visible');
99
99
 
100
100
  cy.makeSnapshot();
101
101
  });
@@ -103,19 +103,12 @@ describe('Bar chart', () => {
103
103
  it(`displays the stacked bar chart ${orientation}ly`, () => {
104
104
  initialize({ data: dataPingServiceStacked, orientation });
105
105
 
106
+ checkWidth(orientation);
106
107
  cy.contains('0 ms').should('be.visible');
107
108
  cy.contains('20').should('be.visible');
108
109
  cy.contains(':40 AM').should('be.visible');
109
110
 
110
- if (equals(orientation, 'horizontal')) {
111
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
112
- .should('have.attr', 'height')
113
- .should('equals', '187');
114
- } else {
115
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
116
- .should('have.attr', 'width')
117
- .should('equals', '546');
118
- }
111
+ cy.findByTestId('stacked-bar-3-0-0.16196').should('be.visible');
119
112
 
120
113
  cy.makeSnapshot();
121
114
  });
@@ -123,21 +116,12 @@ describe('Bar chart', () => {
123
116
  it(`displays bar chart ${orientation}ly with a mix of stacked and non-stacked data`, () => {
124
117
  initialize({ data: dataPingServiceMixedStacked, orientation });
125
118
 
119
+ checkWidth(orientation);
126
120
  cy.contains('0 ms').should('be.visible');
127
121
  cy.contains('20').should('be.visible');
128
122
  cy.contains(':40 AM').should('be.visible');
129
123
 
130
- if (equals(orientation, 'horizontal')) {
131
- cy.findByTestId('stacked-bar-3-0-0.08644')
132
- .should('have.attr', 'height')
133
- .should('equals', '265');
134
- } else {
135
- cy.findByTestId('stacked-bar-3-0-0.08644')
136
- .should('have.attr', 'width')
137
- .should('equals', '773');
138
- }
139
-
140
- cy.makeSnapshot();
124
+ cy.findByTestId('stacked-bar-3-0-0.08644').should('be.visible');
141
125
  });
142
126
 
143
127
  it(`displays the stacked bar chart ${orientation}ly centered in zero`, () => {
@@ -147,19 +131,12 @@ describe('Bar chart', () => {
147
131
  orientation
148
132
  });
149
133
 
134
+ checkWidth(orientation);
150
135
  cy.contains('0 ms').should('be.visible');
151
136
  cy.contains('20').should('be.visible');
152
137
  cy.contains(':40 AM').should('be.visible');
153
138
 
154
- if (equals(orientation, 'horizontal')) {
155
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
156
- .should('have.attr', 'height')
157
- .should('equals', '94');
158
- } else {
159
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
160
- .should('have.attr', 'width')
161
- .should('equals', '273');
162
- }
139
+ cy.findByTestId('stacked-bar-3-0-0.16196').should('be.visible');
163
140
 
164
141
  cy.makeSnapshot();
165
142
  });
@@ -171,19 +148,12 @@ describe('Bar chart', () => {
171
148
  orientation
172
149
  });
173
150
 
151
+ checkWidth(orientation);
174
152
  cy.contains('0 ms').should('be.visible');
175
153
  cy.contains('20').should('be.visible');
176
154
  cy.contains(':40 AM').should('be.visible');
177
155
 
178
- if (equals(orientation, 'horizontal')) {
179
- cy.findByTestId('stacked-bar-3-0-0.08644')
180
- .should('have.attr', 'height')
181
- .should('equals', '133');
182
- } else {
183
- cy.findByTestId('stacked-bar-3-0-0.08644')
184
- .should('have.attr', 'width')
185
- .should('equals', '387');
186
- }
156
+ cy.findByTestId('stacked-bar-3-0-0.08644').should('be.visible');
187
157
  });
188
158
 
189
159
  it(`displays bar chart ${orientation}ly with a custom style`, () => {
@@ -193,19 +163,12 @@ describe('Bar chart', () => {
193
163
  orientation
194
164
  });
195
165
 
166
+ checkWidth(orientation);
196
167
  cy.contains('0 ms').should('be.visible');
197
168
  cy.contains('20').should('be.visible');
198
169
  cy.contains(':40 AM').should('be.visible');
199
170
 
200
- if (equals(orientation, 'horizontal')) {
201
- cy.findByTestId('stacked-bar-3-0-0.08644')
202
- .should('have.attr', 'height')
203
- .should('equals', '265');
204
- } else {
205
- cy.findByTestId('stacked-bar-3-0-0.08644')
206
- .should('have.attr', 'width')
207
- .should('equals', '773');
208
- }
171
+ cy.findByTestId('stacked-bar-3-0-0.08644').should('be.visible');
209
172
  });
210
173
  });
211
174
 
@@ -214,21 +177,18 @@ describe('Bar chart', () => {
214
177
  orientation: 'horizontal'
215
178
  });
216
179
 
180
+ checkWidth('horizontal');
217
181
  cy.contains('0 ms').should('be.visible');
218
182
  cy.contains('20').should('be.visible');
219
183
  cy.contains(':40 AM').should('be.visible');
220
184
 
221
- cy.findByTestId('single-bar-3-2-0.11372').realHover();
185
+ cy.findByTestId('stacked-bar-10-0-7650.368581547736').realHover();
222
186
 
223
187
  cy.contains('06/19/2024').should('be.visible');
224
188
  cy.contains('Centreon-Server: Round-Trip Maximum Time').should(
225
189
  'be.visible'
226
190
  );
227
- cy.contains('0.11 ms').should('be.visible');
228
-
229
- cy.findByTestId('single-bar-3-2-0.08644')
230
- .should('have.attr', 'height')
231
- .should('equals', '295');
191
+ cy.contains('7.47 KB').should('be.visible');
232
192
 
233
193
  cy.makeSnapshot();
234
194
  });
@@ -243,6 +203,7 @@ describe('Bar chart', () => {
243
203
  }
244
204
  });
245
205
 
206
+ checkWidth('horizontal');
246
207
  cy.contains('0 ms').should('be.visible');
247
208
  cy.contains('20').should('be.visible');
248
209
  cy.contains(':40 AM').should('be.visible');
@@ -251,9 +212,7 @@ describe('Bar chart', () => {
251
212
 
252
213
  cy.contains('06/19/2024').should('not.exist');
253
214
 
254
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
255
- .should('have.attr', 'height')
256
- .should('equals', '187');
215
+ cy.findByTestId('stacked-bar-3-0-0.12340000000000001').should('be.visible');
257
216
 
258
217
  cy.makeSnapshot();
259
218
  });
@@ -268,6 +227,7 @@ describe('Bar chart', () => {
268
227
  }
269
228
  });
270
229
 
230
+ checkWidth('horizontal');
271
231
  cy.contains('0 ms').should('be.visible');
272
232
  cy.contains('20').should('be.visible');
273
233
  cy.contains(':40 AM').should('be.visible');
@@ -288,9 +248,7 @@ describe('Bar chart', () => {
288
248
  cy.contains('0.02 ms').should('be.visible');
289
249
  cy.contains('0.11 ms').should('be.visible');
290
250
 
291
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
292
- .should('have.attr', 'height')
293
- .should('equals', '187');
251
+ cy.findByTestId('stacked-bar-3-0-0.16196').should('be.visible');
294
252
 
295
253
  cy.makeSnapshot();
296
254
  });
@@ -305,6 +263,7 @@ describe('Bar chart', () => {
305
263
  }
306
264
  });
307
265
 
266
+ checkWidth('horizontal');
308
267
  cy.contains('0 ms').should('be.visible');
309
268
  cy.contains('20').should('be.visible');
310
269
  cy.contains(':40 AM').should('be.visible');
@@ -317,9 +276,7 @@ describe('Bar chart', () => {
317
276
  );
318
277
  cy.contains('0.05 ms').should('be.visible');
319
278
 
320
- cy.findByTestId('stacked-bar-3-0-0.12340000000000001')
321
- .should('have.attr', 'height')
322
- .should('equals', '187');
279
+ cy.findByTestId('stacked-bar-3-0-0.16196').should('be.visible');
323
280
 
324
281
  cy.makeSnapshot();
325
282
  });
@@ -12,11 +12,11 @@ import { Provider } from 'jotai';
12
12
 
13
13
  import { Box } from '@mui/material';
14
14
 
15
- import { LineChartProps } from '../LineChart/models';
15
+ import { LineChartProps } from '../Chart/models';
16
16
  import { LineChartData, Thresholds } from '../common/models';
17
17
  import { ParentSize } from '../../ParentSize';
18
- import useLineChartData from '../LineChart/useLineChartData';
19
- import LoadingSkeleton from '../LineChart/LoadingSkeleton';
18
+ import useChartData from '../Chart/useChartData';
19
+ import LoadingSkeleton from '../Chart/LoadingSkeleton';
20
20
 
21
21
  import ResponsiveBarChart from './ResponsiveBarChart';
22
22
  import { BarStyle } from './models';
@@ -59,7 +59,7 @@ const BarChart = ({
59
59
  radius: 0.2
60
60
  }
61
61
  }: BarChartProps): JSX.Element => {
62
- const { adjustedData } = useLineChartData({ data, end, start });
62
+ const { adjustedData } = useChartData({ data, end, start });
63
63
  const lineChartRef = useRef<HTMLDivElement | null>(null);
64
64
 
65
65
  if (loading && !adjustedData) {