From 8ef5a0a0e55d7181610f700d6c387e7a6f074876 Mon Sep 17 00:00:00 2001 From: "fabio.d.mota" Date: Tue, 14 May 2024 16:23:36 +0100 Subject: [PATCH] fix(frontend): Fix bug on country picker --- frontend/DEPENDENCIES | 64 ++++++++++--------- frontend/package-lock.json | 15 +++++ frontend/package.json | 1 + .../DashBoardTable/DashboardTable.js | 6 +- 4 files changed, 55 insertions(+), 31 deletions(-) diff --git a/frontend/DEPENDENCIES b/frontend/DEPENDENCIES index baa73c93..8a1c0210 100644 --- a/frontend/DEPENDENCIES +++ b/frontend/DEPENDENCIES @@ -1,30 +1,34 @@ -npm/npmjs/-/axios/1.6.4, MIT, approved, #11338 -npm/npmjs/-/clsx/2.0.0, MIT, approved, clearlydefined -npm/npmjs/-/cssstyle/3.0.0, MIT, approved, clearlydefined -npm/npmjs/-/data-urls/4.0.0, MIT, approved, clearlydefined -npm/npmjs/-/domexception/4.0.0, MIT, approved, clearlydefined -npm/npmjs/-/follow-redirects/1.15.5, MIT, approved, #10782 -npm/npmjs/-/html-encoding-sniffer/3.0.0, MIT, approved, clearlydefined -npm/npmjs/-/html-parse-stringify/3.0.1, MIT, approved, clearlydefined -npm/npmjs/-/http-proxy-agent/5.0.0, MIT, approved, clearlydefined -npm/npmjs/-/i18next/22.5.1, MIT, approved, #9143 -npm/npmjs/-/jsdom/22.0.0, MIT AND LGPL-2.0-or-later, approved, #8188 -npm/npmjs/-/react-i18next/13.5.0, MIT AND Apache-2.0, approved, #11697 -npm/npmjs/-/rrweb-cssom/0.6.0, MIT, approved, clearlydefined -npm/npmjs/-/saxes/6.0.0, ISC, approved, clearlydefined -npm/npmjs/-/tr46/4.1.1, MIT, approved, clearlydefined -npm/npmjs/-/void-elements/3.1.0, MIT, approved, clearlydefined -npm/npmjs/-/w3c-xmlserializer/4.0.0, MIT, approved, clearlydefined -npm/npmjs/-/webidl-conversions/7.0.0, BSD-2-Clause, approved, clearlydefined -npm/npmjs/-/whatwg-encoding/2.0.0, MIT, approved, clearlydefined -npm/npmjs/-/whatwg-mimetype/3.0.0, MIT, approved, clearlydefined -npm/npmjs/-/whatwg-url/12.0.1, MIT, approved, clearlydefined -npm/npmjs/-/xml-name-validator/4.0.0, Apache-2.0, approved, clearlydefined -npm/npmjs/@adobe/css-tools/4.3.2, MIT, approved, #9985 -npm/npmjs/@catena-x/portal-shared-components/2.1.30, Apache-2.0 AND CC-BY-4.0, approved, #10502 -npm/npmjs/@mui/private-theming/5.14.20, MIT, approved, #10973 -npm/npmjs/@mui/styled-engine/5.14.20, MIT, approved, #10971 -npm/npmjs/@mui/system/5.14.20, MIT AND CC-BY-3.0, approved, #9905 -npm/npmjs/@mui/types/7.2.12, MIT, approved, clearlydefined -npm/npmjs/@mui/x-data-grid/6.18.4, MIT AND ISC, approved, #11696 -npm/npmjs/@tootallnate/once/2.0.0, MIT, approved, clearlydefined \ No newline at end of file +npm/npmjs/-/ansi-styles/3.2.1, MIT, approved, clearlydefined +npm/npmjs/-/attr-accept/2.2.2, MIT, approved, clearlydefined +npm/npmjs/-/browserslist/4.23.0, MIT, approved, clearlydefined +npm/npmjs/-/caniuse-lite/1.0.30001607, CC-BY-4.0, approved, #1196 +npm/npmjs/-/chalk/2.4.2, MIT, approved, clearlydefined +npm/npmjs/-/color-convert/1.9.3, MIT, approved, clearlydefined +npm/npmjs/-/color-name/1.1.3, MIT, approved, clearlydefined +npm/npmjs/-/country-data/0.0.31, MIT, approved, #14666 +npm/npmjs/-/currency-symbol-map/2.2.0, BSD-2-Clause, approved, clearlydefined +npm/npmjs/-/electron-to-chromium/1.4.729, ISC, approved, #1950 +npm/npmjs/-/escape-string-regexp/1.0.5, MIT, approved, clearlydefined +npm/npmjs/-/file-selector/0.6.0, MIT, approved, #3230 +npm/npmjs/-/has-flag/3.0.0, MIT, approved, clearlydefined +npm/npmjs/-/node-releases/2.0.14, MIT, approved, #1954 +npm/npmjs/-/postcss/8.4.38, MIT, approved, #3545 +npm/npmjs/-/react-dropzone/14.2.3, MIT, approved, clearlydefined +npm/npmjs/-/source-map-js/1.2.0, BSD-3-Clause, approved, #13911 +npm/npmjs/-/supports-color/5.5.0, MIT, approved, clearlydefined +npm/npmjs/@babel/code-frame/7.24.2, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13943 +npm/npmjs/@babel/compat-data/7.24.4, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13915 +npm/npmjs/@babel/core/7.24.4, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13942 +npm/npmjs/@babel/generator/7.24.4, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13919 +npm/npmjs/@babel/helper-compilation-targets/7.23.6, MIT, approved, clearlydefined +npm/npmjs/@babel/helper-validator-option/7.23.5, MIT, approved, clearlydefined +npm/npmjs/@babel/helpers/7.24.4, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13922 +npm/npmjs/@babel/highlight/7.24.2, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13941 +npm/npmjs/@babel/parser/7.24.4, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13492 +npm/npmjs/@babel/template/7.24.0, MIT, approved, clearlydefined +npm/npmjs/@babel/traverse/7.24.1, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #13926 +npm/npmjs/@babel/types/7.24.0, MIT, approved, clearlydefined +npm/npmjs/@catena-x/portal-shared-components/2.1.40, Apache-2.0 AND CC-BY-4.0, approved, #10502 +npm/npmjs/@jridgewell/gen-mapping/0.3.5, MIT, approved, clearlydefined +npm/npmjs/@jridgewell/set-array/1.2.1, MIT, approved, clearlydefined +npm/npmjs/@jridgewell/trace-mapping/0.3.25, MIT, approved, #9904 \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a342501b..47e828fc 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -19,6 +19,7 @@ "@testing-library/user-event": "^14.5.1", "axios": "1.6.4", "buffer": "^6.0.3", + "country-data": "^0.0.31", "cx-portal-shared-components": "0.4.5", "d3-fetch": "^3.0.1", "env-cmd": "^10.1.0", @@ -6445,6 +6446,15 @@ "node": ">=10" } }, + "node_modules/country-data": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/country-data/-/country-data-0.0.31.tgz", + "integrity": "sha512-YqlY/i6ikZwoBFfdjK+hJTGaBdTgDpXLI15MCj2UsXZ2cPBb+Kx86AXmDH7PRGt0LUleck0cCgNdWeIhfbcxkQ==", + "dependencies": { + "currency-symbol-map": "~2", + "underscore": ">1.4.4" + } + }, "node_modules/create-jest": { "version": "29.7.0", "license": "MIT", @@ -6943,6 +6953,11 @@ "version": "3.1.2", "license": "MIT" }, + "node_modules/currency-symbol-map": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/currency-symbol-map/-/currency-symbol-map-2.2.0.tgz", + "integrity": "sha512-fPZJ3jqM68+AAgqQ7UaGbgHL/39rp6l7GyqS2k1HJPu/kpS8D07x/+Uup6a9tCUKIlOFcRrDCf1qxSt8jnI5BA==" + }, "node_modules/cx-portal-shared-components": { "version": "0.4.5", "license": "Apache-2.0", diff --git a/frontend/package.json b/frontend/package.json index da199204..bff83498 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,6 +15,7 @@ "@testing-library/user-event": "^14.5.1", "axios": "1.6.4", "buffer": "^6.0.3", + "country-data": "^0.0.31", "cx-portal-shared-components": "0.4.5", "d3-fetch": "^3.0.1", "env-cmd": "^10.1.0", diff --git a/frontend/src/components/dashboard/DashBoardTable/DashboardTable.js b/frontend/src/components/dashboard/DashBoardTable/DashboardTable.js index 189f3f57..c8b8ebc2 100644 --- a/frontend/src/components/dashboard/DashBoardTable/DashboardTable.js +++ b/frontend/src/components/dashboard/DashBoardTable/DashboardTable.js @@ -31,6 +31,7 @@ import UserService from "../../services/UserService"; import { CompanyUserContext } from "../../../contexts/companyuser"; import { GatesContext } from "../../../contexts/gates"; import DetailDialog from "../DetailDialog/DetailDialog"; +import { countries } from "country-data"; const DashboardTable2 = (ratings, years) => { //Data Fetch @@ -100,7 +101,10 @@ const DashboardTable2 = (ratings, years) => { if (countryS !== "none") { const array = []; globalData.forEach((gd) => { - if (gd.country === countryS.country) { + const countryFullName = countries[gd.country] + ? countries[gd.country].name + : ""; + if (countryFullName === countryS.country) { array.push(gd); } });