Merge branch 'develop' into release/0.9.0

This commit is contained in:
jwu-fisker
2023-05-09 17:12:39 -07:00
16 changed files with 260 additions and 73 deletions

View File

@@ -9,10 +9,11 @@ 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
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}

View File

@@ -9,10 +9,11 @@ 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
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}

View File

@@ -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}

View File

@@ -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}

View File

@@ -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}

View File

@@ -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}

View File

@@ -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}

View File

@@ -475,6 +475,79 @@ exports[`App Route / authenticated 1`] = `
<div
data-testid="mocked-vehicleprovider"
>
<div
class="MuiFormControl-root MuiFormControl-marginNormal"
>
<label
class="MuiFormLabel-root MuiInputLabel-root makeStyles-whiteBackground-0 MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-outlined MuiFormLabel-filled"
data-shrink="true"
>
Zoom To
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-formControl"
>
<select
aria-invalid="false"
class="MuiSelect-root MuiSelect-select MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input"
>
<option
value="{ \\"center\\": [37.0902, -95.7129], \\"zoom\\": 4.5 }"
>
North America
</option>
<option
value="{ \\"center\\": [33.8463, -118.0461], \\"zoom\\": 10 }"
>
- La Palma
</option>
<option
value="{ \\"center\\": [33.8847, -118.4109], \\"zoom\\": 10 }"
>
- Manhattan Beach
</option>
<option
value="{ \\"center\\": [37.7749, -122.4194], \\"zoom\\": 10 }"
>
- San Francisco
</option>
<option
value="{ \\"center\\": [49.8327, 9.8816], \\"zoom\\": 4.5 }"
>
Europe
</option>
<option
value="{ \\"center\\": [47.0707, 15.4395], \\"zoom\\": 10 }"
>
- Graz
</option>
</select>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-0 MuiOutlinedInput-notchedOutline"
style="padding-left: 8px;"
>
<legend
class="PrivateNotchedOutline-legend-0"
style="width: 0.01px;"
>
<span>
</span>
</legend>
</fieldset>
</div>
</div>
<div
class="leaflet-container leaflet-touch leaflet-grab leaflet-touch-drag leaflet-touch-zoom"
style="width: 100%; height: 900px; position: relative;"
@@ -1799,6 +1872,79 @@ exports[`App Route /home authenticated 1`] = `
<div
data-testid="mocked-vehicleprovider"
>
<div
class="MuiFormControl-root MuiFormControl-marginNormal"
>
<label
class="MuiFormLabel-root MuiInputLabel-root makeStyles-whiteBackground-0 MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiInputLabel-outlined MuiFormLabel-filled"
data-shrink="true"
>
Zoom To
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-formControl"
>
<select
aria-invalid="false"
class="MuiSelect-root MuiSelect-select MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input"
>
<option
value="{ \\"center\\": [37.0902, -95.7129], \\"zoom\\": 4.5 }"
>
North America
</option>
<option
value="{ \\"center\\": [33.8463, -118.0461], \\"zoom\\": 10 }"
>
- La Palma
</option>
<option
value="{ \\"center\\": [33.8847, -118.4109], \\"zoom\\": 10 }"
>
- Manhattan Beach
</option>
<option
value="{ \\"center\\": [37.7749, -122.4194], \\"zoom\\": 10 }"
>
- San Francisco
</option>
<option
value="{ \\"center\\": [49.8327, 9.8816], \\"zoom\\": 4.5 }"
>
Europe
</option>
<option
value="{ \\"center\\": [47.0707, 15.4395], \\"zoom\\": 10 }"
>
- Graz
</option>
</select>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-0 MuiOutlinedInput-notchedOutline"
style="padding-left: 8px;"
>
<legend
class="PrivateNotchedOutline-legend-0"
style="width: 0.01px;"
>
<span>
</span>
</legend>
</fieldset>
</div>
</div>
<div
class="leaflet-container leaflet-touch leaflet-grab leaflet-touch-drag leaflet-touch-zoom"
style="width: 100%; height: 900px; position: relative;"

View File

@@ -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]],
}),

View File

@@ -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",

View File

@@ -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}`,

View File

@@ -6,11 +6,13 @@ import useStyles from "../useStyles";
import GrayMarkerIcon from "../../assets/gray-marker.png";
import GreenMarkerIcon from "../../assets/green-marker.png";
import { DropDownList } from "../Controls/DropDownList";
import { logger } from "../../services/monitoring";
import { ValidateLocationData } from "../../utils/locations";
import { useUserContext } from "../Contexts/UserContext";
import { useVehicleContext, VehicleProvider } from "../Contexts/VehicleContext";
import { VehiclePopUp } from "./popup";
import zoomLocations from './zoomLocations.json';
const Component = () => {
const classes = useStyles();
@@ -60,17 +62,10 @@ const Component = () => {
};
const centerAroundMarkers = (points) => {
// if (markers == null) {
// markers = []
// }
// const coord = markers.reduce((coord, marker) => {
// coord[0] += marker[0] / markers.length;
// coord[1] += marker[1] / markers.length;
// return coord;
// }, [0, 0])
setCenter([37.0902, -95.7129]);
setZoom(4.5);
let defaultLocationJSON = process.env.REACT_APP_HOME_MAP_DEFAULT_LOCATION;
let defaultLocation = JSON.parse(defaultLocationJSON)
setCenter([defaultLocation.lat, defaultLocation.lng]);
setZoom(defaultLocation.zoom);
};
useEffect(() => {
@@ -109,6 +104,12 @@ const Component = () => {
setSelectedVIN(vin);
};
const focusMap = (e) => {
let zoomLocation = JSON.parse(e.target.value)
setCenter(zoomLocation.center);
setZoom(zoomLocation.zoom)
}
const retrieveAndStoreCarState = (vin) => {
getState(token, vin).then((results) => {
setCarState({ ...results.data, vin: vin });
@@ -143,6 +144,8 @@ const Component = () => {
}
return (
<>
<DropDownList label="Zoom To" data={zoomLocations} classes={classes} onChange={focusMap} />
<MapContainer
center={center}
zoom={zoom}
@@ -192,6 +195,7 @@ const Component = () => {
/>
) : null}
</MapContainer>
</>
);
};

View File

@@ -0,0 +1,26 @@
[
{
"value": "{ \"center\": [37.0902, -95.7129], \"zoom\": 4.5 }",
"label": "North America"
},
{
"value": "{ \"center\": [33.8463, -118.0461], \"zoom\": 10 }",
"label": "- La Palma"
},
{
"value": "{ \"center\": [33.8847, -118.4109], \"zoom\": 10 }",
"label": "- Manhattan Beach"
},
{
"value": "{ \"center\": [37.7749, -122.4194], \"zoom\": 10 }",
"label": "- San Francisco"
},
{
"value": "{ \"center\": [49.8327, 9.8816], \"zoom\": 4.5 }",
"label": "Europe"
},
{
"value": "{ \"center\": [47.0707, 15.4395], \"zoom\": 10 }",
"label": "- Graz"
}
]

View File

@@ -60,6 +60,8 @@ const ComponentVehiclePathsMap = (props) => {
// validate each location
for (let vinLocations of resultArray) {
// 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] = []
@@ -70,6 +72,7 @@ const ComponentVehiclePathsMap = (props) => {
}
points.push(path)
}
}
setMarkers(points);
return points;

View File

@@ -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],
},

View File

@@ -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);