From ad5a7a527e7b0289a21f207f1859debd7e11033d Mon Sep 17 00:00:00 2001 From: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com> Date: Mon, 1 May 2023 11:36:10 -0400 Subject: [PATCH 1/3] CEC-3933 - Ensure zoom to car on Vehicle Map load (#326) * CEC-3933 - Parse VehiclePaths location data * changes * fixes * stuff * sort of works * fix * progress * refactor * fix vehicle paths query * digital twin shows map * new dashboard * wider digital twin map * snapshot * latest; using polylines * lag lng changes * stuff * path showing up * stuff * things * revert home page * whitespace * validation * more stuff * fix button issue * tests pass without mocking data * fix code smells * remove map from digital twin, add to tab * fix bug * marker click event working * individual colors * possible fix * fix warning * merge and remove unused code * small fixes * re add dashboard * snaps * CEC-3933 - Ensure zoom to car on Vehicle Map load --- .../Contexts/__mocks__/VehicleContext.jsx | 1 + src/components/VehiclePathsMap/index.jsx | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/Contexts/__mocks__/VehicleContext.jsx b/src/components/Contexts/__mocks__/VehicleContext.jsx index 3c76ba1..31e4283 100644 --- a/src/components/Contexts/__mocks__/VehicleContext.jsx +++ b/src/components/Contexts/__mocks__/VehicleContext.jsx @@ -137,6 +137,7 @@ export const useVehicleContext = () => ({ .fn() .mockResolvedValue({ // tests only pass without mocking the data here + // '3FAFP13P71R199267': [], // '3FAFP13P31R199430': [[16.891136999999986, 26.832352999999955], [56.891136999999986, 66.832352999999955], [26.891136999999986, 36.832352999999955]], // '3FAFP13P71R199060': [[36.891136999999986, 46.832352999999955], [76.891136999999986, 16.832352999999955]], }), diff --git a/src/components/VehiclePathsMap/index.jsx b/src/components/VehiclePathsMap/index.jsx index 97f7961..62449ee 100644 --- a/src/components/VehiclePathsMap/index.jsx +++ b/src/components/VehiclePathsMap/index.jsx @@ -60,15 +60,18 @@ const ComponentVehiclePathsMap = (props) => { // validate each location for (let vinLocations of resultArray) { - let path = [] - path[0] = vinLocations[0] - path[1] = [] - for (let location of vinLocations[1]) { - if (ValidateLocationVehiclePathsData(location) !== false) { - path[1].push(location); + // if there are points for the vin; skip if empty points array + if (vinLocations[0] && vinLocations[1] && vinLocations[1][0]) { + let path = [] + path[0] = vinLocations[0] + path[1] = [] + for (let location of vinLocations[1]) { + if (ValidateLocationVehiclePathsData(location) !== false) { + path[1].push(location); + } } + points.push(path) } - points.push(path) } setMarkers(points); From 8752445aeb67a27982d4d6940fc369da536da22d Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Tue, 2 May 2023 17:13:26 -0700 Subject: [PATCH 2/3] CEC-4250, CEC-4251 Fix timed out test (#328) --- .env.cec-euprd | 2 +- .env.cec-prd | 2 +- src/components/App/App.test.js | 1 + src/components/Layouts/SideMenu.jsx | 4 ++-- src/components/Manifest/List/index.jsx | 2 +- src/utils/roles.js | 2 +- src/utils/roles.test.js | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.env.cec-euprd b/.env.cec-euprd index 0bcb8e9..a9648bd 100644 --- a/.env.cec-euprd +++ b/.env.cec-euprd @@ -9,7 +9,7 @@ REACT_APP_SECURITY_DLL_URL=https://assets.fiskerdps.com/cloud-supplier/fisker_se REACT_APP_SECURITY_DLL_64_URL=https://assets.fiskerdps.com/cloud-supplier/fisker_security_64.dll REACT_APP_SUPERSET_URL=https://superset.cec-euprd.fiskerinc.com REACT_APP_ROLE_CREATE=e92f2b3e-1b80-42e5-9483-8ae648224dc6 -REACT_APP_ROLE_READ_ONLY=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc +REACT_APP_ROLE_READ_ONLY=ae5123e3-7a6a-4ca9-947b-a0f184f82cbd REACT_APP_ROLE_DELETE=bfd1cccc-213a-4f31-b3d1-6e685976aec8 REACT_APP_ROLE_GENERATE_CERTIFICATE=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 diff --git a/.env.cec-prd b/.env.cec-prd index 54ea7a8..9f9fb70 100644 --- a/.env.cec-prd +++ b/.env.cec-prd @@ -9,7 +9,7 @@ REACT_APP_SECURITY_DLL_URL=https://assets.fiskerdps.com/cloud-supplier/fisker_se REACT_APP_SECURITY_DLL_64_URL=https://assets.fiskerdps.com/cloud-supplier/fisker_security_64.dll REACT_APP_SUPERSET_URL=https://superset.cec-prd.fiskerinc.com REACT_APP_ROLE_CREATE=e92f2b3e-1b80-42e5-9483-8ae648224dc6 -REACT_APP_ROLE_READ_ONLY=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc +REACT_APP_ROLE_READ_ONLY=ae5123e3-7a6a-4ca9-947b-a0f184f82cbd REACT_APP_ROLE_DELETE=bfd1cccc-213a-4f31-b3d1-6e685976aec8 REACT_APP_ROLE_GENERATE_CERTIFICATE=9af2d8c0-c26d-4d6d-bbd1-ac53cbd37ebc REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 diff --git a/src/components/App/App.test.js b/src/components/App/App.test.js index df56ca3..f665b6e 100644 --- a/src/components/App/App.test.js +++ b/src/components/App/App.test.js @@ -51,6 +51,7 @@ describe("App", () => { beforeAll(() => { global.URL.createObjectURL = jest.fn(); addSnapshotSerializer(expect); + jest.setTimeout(10000); }, 60000); afterEach(() => { diff --git a/src/components/Layouts/SideMenu.jsx b/src/components/Layouts/SideMenu.jsx index f0d24cf..408cb76 100644 --- a/src/components/Layouts/SideMenu.jsx +++ b/src/components/Layouts/SideMenu.jsx @@ -9,10 +9,10 @@ import HomeIcon from "@material-ui/icons/Home"; import SettingsInputCompositeIcon from "@material-ui/icons/SettingsInputComposite"; import { default as React, useEffect, useState } from "react"; +import { getCustomDashboardSubmenu } from "../../services/customDashboards"; import { hasRole, Permissions } from "../../utils/roles"; import { useUserContext } from "../Contexts/UserContext"; import { ExpandableSideMenuItem, MenuItem } from "./MenuItem"; -import { getCustomDashboardSubmenu } from "../../services/customDashboards" const menuData = [ { @@ -67,7 +67,7 @@ const menuData = [ { label: "Certificate", to: "/tools/certificates/add", - rolesPerProvider: Permissions.FiskerCertificate, + rolesPerProvider: Permissions.FiskerMagnaCertificate, }, { label: "Security.dll", diff --git a/src/components/Manifest/List/index.jsx b/src/components/Manifest/List/index.jsx index eca560c..e41d28f 100644 --- a/src/components/Manifest/List/index.jsx +++ b/src/components/Manifest/List/index.jsx @@ -195,7 +195,7 @@ const MainForm = () => { ), }); } - if (hasRole(groups, Permissions.FiskerRead, providers)) { + if (hasRole(groups, Permissions.FiskerCreate, providers)) { actions.push({ tip: `Update "${row.name} ${row.version}"`, link: `/package-update/${row.id}`, diff --git a/src/utils/roles.js b/src/utils/roles.js index 4875da4..69f1d18 100644 --- a/src/utils/roles.js +++ b/src/utils/roles.js @@ -77,7 +77,7 @@ export const Permissions = { [Providers.MAGNA]: [Roles.MAGNAGROUP], }, FiskerTools: { - [Providers.FISKER]: [Roles.APPROVESUPPLIERS, Roles.CERTIFICATES], + [Providers.FISKER]: [Roles.CERTIFICATES, Roles.CREATE], [Providers.FISKER_QA]: [Roles.MANUFACTURE], [Providers.MAGNA]: [Roles.MAGNAGROUP], }, diff --git a/src/utils/roles.test.js b/src/utils/roles.test.js index 3ed5719..c4198ac 100644 --- a/src/utils/roles.test.js +++ b/src/utils/roles.test.js @@ -56,7 +56,7 @@ describe("Roles Helper", () => { it("Check FiskerTools permission", () => { expect( hasRole([Roles.APPROVESUPPLIERS], Permissions.FiskerTools, [Providers.FISKER]) - ).toEqual(true); + ).toEqual(false); expect( hasRole([Roles.CERTIFICATES], Permissions.FiskerTools, [Providers.FISKER]) ).toEqual(true); From a59cd3b69fc38f55ca12dad95e56a6e38144ffd0 Mon Sep 17 00:00:00 2001 From: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com> Date: Thu, 4 May 2023 15:46:43 -0400 Subject: [PATCH 3/3] CEC-3932 - position of home map based on location (#327) * CEC-3932 - position of home map based on location * EasyButtons added * remove unused icons * use dropdown * revert unneeded changes * updates from review * update snap --- .env.cec-euprd | 1 + .env.cec-prd | 1 + .env.dev | 1 + .env.local | 1 + .env.prd | 1 + .env.stg | 1 + .env.template | 1 + .../App/__snapshots__/App.test.js.snap | 146 ++++++++++++++++++ src/components/VehicleMap/index.jsx | 122 ++++++++------- src/components/VehicleMap/zoomLocations.json | 26 ++++ 10 files changed, 242 insertions(+), 59 deletions(-) create mode 100644 src/components/VehicleMap/zoomLocations.json diff --git a/.env.cec-euprd b/.env.cec-euprd index a9648bd..7b9dcef 100644 --- a/.env.cec-euprd +++ b/.env.cec-euprd @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV= +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":49.8327,"lng":9.8816,"zoom":4.5} diff --git a/.env.cec-prd b/.env.cec-prd index 9f9fb70..d30b7e4 100644 --- a/.env.cec-prd +++ b/.env.cec-prd @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV= +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5} diff --git a/.env.dev b/.env.dev index e08c37a..a04f46a 100644 --- a/.env.dev +++ b/.env.dev @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV=stage,prod +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5} diff --git a/.env.local b/.env.local index 71f52ab..788b410 100644 --- a/.env.local +++ b/.env.local @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV=dev,stage,prod +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5} diff --git a/.env.prd b/.env.prd index 4174e96..f812b2a 100644 --- a/.env.prd +++ b/.env.prd @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV=stage +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5} diff --git a/.env.stg b/.env.stg index 8bb96c4..702381f 100644 --- a/.env.stg +++ b/.env.stg @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV=prod +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5} diff --git a/.env.template b/.env.template index 1cdf893..517bef2 100644 --- a/.env.template +++ b/.env.template @@ -16,3 +16,4 @@ REACT_APP_ROLE_MANUFACTURE=3412e11a-a2d1-4355-be3e-ef9aa5065b69 REACT_APP_ROLE_SUPPLIER_APPROVER=a6c9805e-80b2-42b2-bfbb-9df52e5504d8 REACT_APP_ROLE_MANIFEST_MIGRATION=42798c8a-9fa7-4fb4-82c0-9582cabe364f REACT_APP_ECCKEY_ENV=dev,stage,prod +REACT_APP_HOME_MAP_DEFAULT_LOCATION={"lat":37.0902,"lng":-95.7129,"zoom":4.5} diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 909fc68..9795528 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -475,6 +475,79 @@ exports[`App Route / authenticated 1`] = `
- {marker[2]} -
- -+ {marker[2]} +
+ +