Skip to content

Commit 9f56d6d

Browse files
committed
Merge branch 'improvement/charts-restructuration' into q/1.0
2 parents 49558b8 + 5872b07 commit 9f56d6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1379
-4159
lines changed

package-lock.json

Lines changed: 24 additions & 824 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,7 @@
110110
"recharts": "^3.0.2",
111111
"styled-components": "^5.2.1",
112112
"styled-system": "^5.1.5",
113-
"uuid": "^13.0.0",
114-
"vega": "^5.17.3",
115-
"vega-embed": "6.0.0",
116-
"vega-lite": "5.0.0",
117-
"vega-tooltip": "0.27.0"
113+
"uuid": "^13.0.0"
118114
},
119115
"homepage": "https://scality.github.io/core-ui/",
120116
"publishConfig": {

src/lib/components/barchart/BarChart.component.tsx

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/lib/components/linetemporalchart/MetricTimespanProvider.tsx renamed to src/lib/components/charts/MetricsTimeSpanProvider.tsx

File renamed without changes.

src/lib/components/barchartv2/Barchart.component.test.tsx renamed to src/lib/components/charts/barchart/Barchart.test.tsx

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { render, screen, waitFor } from '@testing-library/react';
2-
import { getWrapper } from '../../testUtils';
3-
import { Barchart, CustomTick } from './Barchart.component';
4-
import { ChartLegendWrapper } from '../chartlegend/ChartLegendWrapper';
2+
import { getWrapper } from '../../../testUtils';
3+
import { Barchart } from './Barchart';
4+
import { ChartLegendWrapper } from '../legend/ChartLegendWrapper';
55
import React from 'react';
6+
import { CustomTick } from '../common/SharedComponents';
67

78
const ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
89
const ONE_HOUR_IN_MILLISECONDS = 60 * 60 * 1000;
@@ -60,21 +61,27 @@ describe('Barchart', () => {
6061
render(
6162
<Wrapper>
6263
<ChartLegendWrapper colorSet={testColorSet}>
63-
<Barchart type={{ type: 'category' }} bars={testBars} />
64+
<Barchart
65+
title="Test Title"
66+
type={{ type: 'category' }}
67+
bars={testBars}
68+
/>
6469
</ChartLegendWrapper>
6570
</Wrapper>,
6671
);
67-
72+
expect(screen.getByText('Test Title')).toBeInTheDocument();
6873
expect(screen.getByText('category1')).toBeInTheDocument();
6974
expect(screen.getByText('category2')).toBeInTheDocument();
7075
expect(screen.getByText('category3')).toBeInTheDocument();
7176
});
77+
7278
it('should render the Barchart component with time data', async () => {
7379
const { Wrapper } = getWrapper();
7480
render(
7581
<Wrapper>
7682
<ChartLegendWrapper colorSet={testColorSet}>
7783
<Barchart
84+
title="Test Title"
7885
type={{
7986
type: 'time',
8087
timeRange: {
@@ -98,7 +105,12 @@ describe('Barchart', () => {
98105
render(
99106
<Wrapper>
100107
<ChartLegendWrapper colorSet={testColorSet}>
101-
<Barchart type={{ type: 'category' }} bars={[]} isError />
108+
<Barchart
109+
title="Test Title"
110+
type={{ type: 'category' }}
111+
bars={[]}
112+
isError
113+
/>
102114
</ChartLegendWrapper>
103115
</Wrapper>,
104116
);
@@ -111,7 +123,12 @@ describe('Barchart', () => {
111123
render(
112124
<Wrapper>
113125
<ChartLegendWrapper colorSet={testColorSet}>
114-
<Barchart type={{ type: 'category' }} bars={[]} isLoading />
126+
<Barchart
127+
title="Test Title"
128+
type={{ type: 'category' }}
129+
bars={[]}
130+
isLoading
131+
/>
115132
</ChartLegendWrapper>
116133
</Wrapper>,
117134
);
@@ -122,7 +139,11 @@ describe('Barchart', () => {
122139
render(
123140
<Wrapper>
124141
<ChartLegendWrapper colorSet={testColorSet}>
125-
<Barchart type={{ type: 'category' }} bars={undefined} />
142+
<Barchart
143+
title="Test Title"
144+
type={{ type: 'category' }}
145+
bars={undefined}
146+
/>
126147
</ChartLegendWrapper>
127148
</Wrapper>,
128149
);
@@ -139,6 +160,7 @@ describe('Barchart', () => {
139160
<Wrapper>
140161
<ChartLegendWrapper colorSet={testColorSet}>
141162
<Barchart
163+
title="Test Title"
142164
type={{
143165
type: 'time',
144166
timeRange: {
@@ -196,7 +218,7 @@ describe('Barchart', () => {
196218
Failed: 'lineColor2',
197219
}}
198220
>
199-
<Barchart type={type} bars={bars} />
221+
<Barchart title="Test Title" type={type} bars={bars} />
200222
</ChartLegendWrapper>
201223
</Wrapper>,
202224
);
@@ -239,7 +261,7 @@ describe('Barchart', () => {
239261
render(
240262
<Wrapper>
241263
<ChartLegendWrapper colorSet={testColorSet}>
242-
<Barchart type={type} bars={testTimeBars} />
264+
<Barchart title="Test Title" type={type} bars={testTimeBars} />
243265
</ChartLegendWrapper>
244266
</Wrapper>,
245267
);
@@ -270,6 +292,7 @@ describe('Barchart', () => {
270292
<Wrapper>
271293
<ChartLegendWrapper colorSet={testColorSet}>
272294
<Barchart
295+
title="Test Title"
273296
type={{
274297
type: 'time',
275298
timeRange: {
@@ -317,6 +340,7 @@ describe('Barchart', () => {
317340
<Wrapper>
318341
<ChartLegendWrapper colorSet={{ ...testColorSet, Failed: 'red' }}>
319342
<Barchart
343+
title="Test Title"
320344
type={{ type: 'category' }}
321345
bars={testStackedBars}
322346
stacked
@@ -348,6 +372,7 @@ describe('Barchart', () => {
348372
<Wrapper>
349373
<ChartLegendWrapper colorSet={testColorSet}>
350374
<Barchart
375+
title="Test Title"
351376
type={{ type: 'category' }}
352377
bars={testBars}
353378
defaultSort={(pointA, pointB) => {

0 commit comments

Comments
 (0)