Skip to content

Commit 1b4eacb

Browse files
authored
Remove Chartsjs and react-chartjs-2 (#2677)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
1 parent f21434a commit 1b4eacb

File tree

5 files changed

+82
-179
lines changed

5 files changed

+82
-179
lines changed

portal-ui/package.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,14 @@
1212
"@mui/styles": "^5.11.2",
1313
"@mui/x-date-pickers": "^5.0.15",
1414
"@reduxjs/toolkit": "^1.9.1",
15-
"@types/lodash": "^4.14.191",
16-
"@types/minio": "^7.0.15",
17-
"@types/node": "18.11.18",
18-
"@types/react": "18.0.27",
19-
"@types/react-copy-to-clipboard": "^5.0.2",
20-
"@types/react-dom": "18.0.10",
21-
"@types/react-grid-layout": "^1.1.1",
22-
"@types/react-redux": "^7.1.25",
23-
"@types/react-virtualized": "^9.21.21",
24-
"@types/superagent": "^4.1.16",
25-
"@types/webpack-env": "^1.14.1",
26-
"@types/websocket": "^1.0.0",
2715
"@uiw/react-textarea-code-editor": "^2.0.6",
28-
"chart.js": "^2.9.3",
2916
"kbar": "^0.1.0-beta.39",
3017
"local-storage-fallback": "^4.1.1",
3118
"lodash": "^4.17.21",
3219
"luxon": "^3.2.1",
3320
"mds": "https://github.com/minio/mds.git#v0.2.5",
3421
"minio": "^7.0.32",
3522
"react": "^18.1.0",
36-
"react-chartjs-2": "^2.9.0",
3723
"react-component-export-image": "^1.0.6",
3824
"react-copy-to-clipboard": "^5.0.2",
3925
"react-dom": "^18.1.0",
@@ -79,6 +65,18 @@
7965
"@types/react-window": "^1.8.5",
8066
"@types/react-window-infinite-loader": "^1.0.6",
8167
"@types/recharts": "^1.8.24",
68+
"@types/lodash": "^4.14.191",
69+
"@types/minio": "^7.0.15",
70+
"@types/node": "18.11.18",
71+
"@types/react": "18.0.27",
72+
"@types/react-copy-to-clipboard": "^5.0.2",
73+
"@types/react-dom": "18.0.10",
74+
"@types/react-grid-layout": "^1.1.1",
75+
"@types/react-redux": "^7.1.25",
76+
"@types/react-virtualized": "^9.21.21",
77+
"@types/superagent": "^4.1.16",
78+
"@types/webpack-env": "^1.14.1",
79+
"@types/websocket": "^1.0.0",
8280
"prettier": "2.8.3",
8381
"react-scripts": "5.0.1",
8482
"testcafe": "^2.3.0",

portal-ui/src/screens/Console/Common/Components/FeatureNotAvailable.tsx

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

portal-ui/src/screens/Console/Common/Components/FeatureNotAvailablePage.tsx

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

portal-ui/src/screens/Console/Heal/Heal.tsx

Lines changed: 67 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import React, { Fragment, useEffect, useState } from "react";
1818
import { useSelector } from "react-redux";
19-
import { HorizontalBar } from "react-chartjs-2";
2019
import {
2120
FormControl,
2221
Grid,
@@ -53,6 +52,16 @@ import DistributedOnly from "../Common/DistributedOnly/DistributedOnly";
5352
import { selDistSet } from "../../../systemSlice";
5453
import makeStyles from "@mui/styles/makeStyles";
5554
import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper";
55+
import {
56+
Bar,
57+
BarChart,
58+
CartesianGrid,
59+
ResponsiveContainer,
60+
Tooltip,
61+
XAxis,
62+
YAxis,
63+
} from "recharts";
64+
import { Legend } from "recharts";
5665

5766
const useStyles = makeStyles((theme: Theme) =>
5867
createStyles({
@@ -227,25 +236,32 @@ const Heal = () => {
227236
}
228237
}, [start, bucketName, forceStart, forceStop, prefix, recursive]);
229238

230-
let data = {
231-
labels: ["Green", "Yellow", "Red", "Grey"],
232-
datasets: [
233-
{
234-
label: "After Healing",
235-
data: hStatus.afterHeal,
236-
backgroundColor: "rgba(0, 0, 255, 0.2)",
237-
borderColor: "rgba(54, 162, 235, 1)",
238-
borderWidth: 1,
239-
},
240-
{
241-
label: "Before Healing",
242-
data: hStatus.beforeHeal,
243-
backgroundColor: "rgba(153, 102, 255, 0.2)",
244-
borderColor: "rgba(153, 102, 255, 1)",
245-
borderWidth: 1,
246-
},
247-
],
248-
};
239+
let data = [
240+
{
241+
name: "Green",
242+
ah: hStatus.afterHeal[0],
243+
bh: hStatus.beforeHeal[0],
244+
amt: 100,
245+
},
246+
{
247+
name: "Yellow",
248+
ah: hStatus.afterHeal[1],
249+
bh: hStatus.beforeHeal[1],
250+
amt: 100,
251+
},
252+
{
253+
name: "Red",
254+
ah: hStatus.afterHeal[2],
255+
bh: hStatus.beforeHeal[2],
256+
amt: 100,
257+
},
258+
{
259+
name: "Grey",
260+
ah: hStatus.afterHeal[3],
261+
bh: hStatus.beforeHeal[3],
262+
amt: 100,
263+
},
264+
];
249265
const bucketNames = bucketList.map((bucketName) => ({
250266
label: bucketName.name,
251267
value: bucketName.name,
@@ -352,22 +368,37 @@ const Heal = () => {
352368
</Grid>
353369
</Grid>
354370
<Grid item xs={12} className={classes.graphContainer}>
355-
<HorizontalBar
356-
data={data}
357-
width={80}
358-
height={30}
359-
options={{
360-
title: {
361-
display: true,
362-
text: "Item's Health Status [%]",
363-
fontSize: 20,
364-
},
365-
legend: {
366-
display: true,
367-
position: "right",
368-
},
369-
}}
370-
/>
371+
<ResponsiveContainer width={"90%"} height={400}>
372+
<BarChart
373+
width={600}
374+
height={400}
375+
data={data}
376+
margin={{
377+
top: 5,
378+
right: 30,
379+
left: 20,
380+
bottom: 5,
381+
}}
382+
>
383+
<CartesianGrid strokeDasharray="3 3" />
384+
<XAxis dataKey="name" />
385+
<YAxis />
386+
<Tooltip />
387+
<Legend verticalAlign={"top"} layout={"vertical"} />
388+
<Bar
389+
dataKey="ah"
390+
name={"After Healing"}
391+
fill="rgba(0, 0, 255, 0.2)"
392+
stroke="rgba(0, 0, 255, 1)"
393+
/>
394+
<Bar
395+
dataKey="bh"
396+
name={"Before Healing"}
397+
fill="rgba(153, 102, 255, 0.2)"
398+
stroke="rgba(153, 102, 255, 1)"
399+
/>
400+
</BarChart>
401+
</ResponsiveContainer>
371402
<Grid item xs={12} className={classes.scanInfo}>
372403
<div className={classes.scanData}>
373404
<strong>Size scanned:</strong> {hStatus.sizeScanned}

portal-ui/yarn.lock

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,29 +3878,6 @@ character-reference-invalid@^2.0.0:
38783878
resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz#85c66b041e43b47210faf401278abf808ac45cb9"
38793879
integrity sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==
38803880

3881-
chart.js@^2.9.3:
3882-
version "2.9.4"
3883-
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.9.4.tgz#0827f9563faffb2dc5c06562f8eb10337d5b9684"
3884-
integrity sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==
3885-
dependencies:
3886-
chartjs-color "^2.1.0"
3887-
moment "^2.10.2"
3888-
3889-
chartjs-color-string@^0.6.0:
3890-
version "0.6.0"
3891-
resolved "https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz#1df096621c0e70720a64f4135ea171d051402f71"
3892-
integrity sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==
3893-
dependencies:
3894-
color-name "^1.0.0"
3895-
3896-
chartjs-color@^2.1.0:
3897-
version "2.4.1"
3898-
resolved "https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.4.1.tgz#6118bba202fe1ea79dd7f7c0f9da93467296c3b0"
3899-
integrity sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==
3900-
dependencies:
3901-
chartjs-color-string "^0.6.0"
3902-
color-convert "^1.9.3"
3903-
39043881
check-error@^1.0.2:
39053882
version "1.0.2"
39063883
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
@@ -4022,7 +3999,7 @@ collect-v8-coverage@^1.0.0:
40223999
resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59"
40234000
integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==
40244001

4025-
color-convert@^1.9.0, color-convert@^1.9.3:
4002+
color-convert@^1.9.0:
40264003
version "1.9.3"
40274004
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
40284005
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
@@ -4041,7 +4018,7 @@ color-name@1.1.3:
40414018
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
40424019
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
40434020

4044-
color-name@^1.0.0, color-name@^1.1.4, color-name@~1.1.4:
4021+
color-name@^1.1.4, color-name@~1.1.4:
40454022
version "1.1.4"
40464023
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
40474024
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
@@ -8355,7 +8332,7 @@ moment-duration-format-commonjs@^1.0.0:
83558332
resolved "https://registry.yarnpkg.com/moment-duration-format-commonjs/-/moment-duration-format-commonjs-1.0.1.tgz#ca8776466dba736a30cb7cda4e07026b5aec8cf1"
83568333
integrity sha512-KhKZRH21/+ihNRWrmdNFOyBptFi7nAWZFeFsRRpXkzgk/Yublb4fxyP0jU6EY1VDxUL/VUPdCmm/wAnpbfXdfw==
83578334

8358-
moment@^2.10.2, moment@^2.14.1, moment@^2.29.4:
8335+
moment@^2.14.1, moment@^2.29.4:
83598336
version "2.29.4"
83608337
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
83618338
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
@@ -9704,14 +9681,6 @@ react-app-polyfill@^3.0.0:
97049681
regenerator-runtime "^0.13.9"
97059682
whatwg-fetch "^3.6.2"
97069683

9707-
react-chartjs-2@^2.9.0:
9708-
version "2.11.2"
9709-
resolved "https://registry.yarnpkg.com/react-chartjs-2/-/react-chartjs-2-2.11.2.tgz#156c0d2618600561efc23bef278bd48a335cadb6"
9710-
integrity sha512-hcPS9vmRJeAALPPf0uo02BiD8BDm0HNmneJYTZVR74UKprXOpql+Jy1rVuj93rKw0Jfx77mkcRfXPxTe5K83uw==
9711-
dependencies:
9712-
lodash "^4.17.19"
9713-
prop-types "^15.7.2"
9714-
97159684
react-component-export-image@^1.0.6:
97169685
version "1.0.6"
97179686
resolved "https://registry.yarnpkg.com/react-component-export-image/-/react-component-export-image-1.0.6.tgz#725ec7636245f4042fa05c57ece02e9ee4b00117"

0 commit comments

Comments
 (0)