From 28f968efc7a5ef5319b803bfc80241a23a417d03 Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Mon, 5 Jun 2023 17:08:05 -0700 Subject: [PATCH] CEC-4450 debug mask (#343) * CEC-4450 Enable debug mask using REACT_APP_ENABLE_DEBUG * rename --- .env.cec-euprd | 1 + .env.cec-prd | 1 + .env.dev | 1 + .env.local | 1 + .env.prd | 1 + .env.stg | 1 + src/components/Cars/Status/Details/index.jsx | 3 +-- src/components/Cars/Update/index.jsx | 17 ++++++++--------- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.env.cec-euprd b/.env.cec-euprd index 7b9dcef..74cb850 100644 --- a/.env.cec-euprd +++ b/.env.cec-euprd @@ -17,3 +17,4 @@ 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} +REACT_APP_ENABLE_DEBUGMASK=1 \ No newline at end of file diff --git a/.env.cec-prd b/.env.cec-prd index d30b7e4..074549f 100644 --- a/.env.cec-prd +++ b/.env.cec-prd @@ -17,3 +17,4 @@ 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} +REACT_APP_ENABLE_DEBUGMASK=1 \ No newline at end of file diff --git a/.env.dev b/.env.dev index a04f46a..7fdf5cb 100644 --- a/.env.dev +++ b/.env.dev @@ -17,3 +17,4 @@ 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} +REACT_APP_ENABLE_DEBUGMASK=1 \ No newline at end of file diff --git a/.env.local b/.env.local index 788b410..2311225 100644 --- a/.env.local +++ b/.env.local @@ -17,3 +17,4 @@ 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} +REACT_APP_ENABLE_DEBUGMASK=1 \ No newline at end of file diff --git a/.env.prd b/.env.prd index f812b2a..878fe6b 100644 --- a/.env.prd +++ b/.env.prd @@ -17,3 +17,4 @@ 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} +REACT_APP_ENABLE_DEBUGMASK=1 \ No newline at end of file diff --git a/.env.stg b/.env.stg index 702381f..df9db72 100644 --- a/.env.stg +++ b/.env.stg @@ -17,3 +17,4 @@ 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} +REACT_APP_ENABLE_DEBUGMASK=1 \ No newline at end of file diff --git a/src/components/Cars/Status/Details/index.jsx b/src/components/Cars/Status/Details/index.jsx index ac8bc70..585d15a 100644 --- a/src/components/Cars/Status/Details/index.jsx +++ b/src/components/Cars/Status/Details/index.jsx @@ -35,8 +35,7 @@ const MainForm = ({ vin }) => { providers, } = useUserContext(); - const ENV = process.env.REACT_APP_ENV; - const showDebugMask = (ENV === 'local' || ENV === 'dev' || ENV === 'stg' || ENV === 'prd') + const showDebugMask = (process.env.REACT_APP_ENABLE_DEBUGMASK === "1"); useEffect(() => { (async () => { diff --git a/src/components/Cars/Update/index.jsx b/src/components/Cars/Update/index.jsx index cdbf11d..2b4d965 100644 --- a/src/components/Cars/Update/index.jsx +++ b/src/components/Cars/Update/index.jsx @@ -1,6 +1,3 @@ -import React, { useEffect, useRef, useState } from "react"; -import { Redirect } from "react-router"; -import { useLocation } from "react-router-dom"; import { Button, Checkbox, @@ -11,15 +8,18 @@ import { RadioGroup, TextField } from "@material-ui/core"; +import React, { useEffect, useRef, useState } from "react"; +import { Redirect } from "react-router"; +import { useLocation } from "react-router-dom"; -import useStyles from "../../useStyles"; +import { logger } from "../../../services/monitoring"; +import { useStatusContext } from "../../Contexts/StatusContext"; +import { useUserContext } from "../../Contexts/UserContext"; import { useVehicleContext, VehicleProvider } from "../../Contexts/VehicleContext"; -import { useStatusContext } from "../../Contexts/StatusContext"; -import { useUserContext } from "../../Contexts/UserContext"; -import { logger } from "../../../services/monitoring"; +import useStyles from "../../useStyles"; const MainForm = () => { @@ -48,8 +48,7 @@ const MainForm = () => { const [maxDiskBufferSize, setMaxDiskBufferSize] = useState(0); const debugMaskEl = useRef(null); - const ENV = process.env.REACT_APP_ENV; - const showDebugMask = (ENV === 'local' || ENV === 'dev' || ENV === 'stg' || ENV === 'prd') + const showDebugMask = (process.env.REACT_APP_ENABLE_DEBUGMASK === "1"); useEffect(() => { setTitle("Update Vehicle");