diff --git a/.env.cec-euprd b/.env.cec-euprd index 763a959..5fb535f 100644 --- a/.env.cec-euprd +++ b/.env.cec-euprd @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cec-euprd.fiskerinc.com REACT_APP_AUTH_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/certificate +REACT_APP_ENV=cec-euprd REACT_APP_MAGNA_PROVIDER=Magna REACT_APP_MAGNA_GROUP_ID=68273225-9da4-4fa7-aea5-38e16ec471fe REACT_APP_OTA_SERVICE_URL=https://gw.cec-euprd.fiskerinc.com/ota_update diff --git a/.env.cec-prd b/.env.cec-prd index 956480c..67d8f04 100644 --- a/.env.cec-prd +++ b/.env.cec-prd @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cec-prd.fiskerinc.com REACT_APP_AUTH_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/certificate +REACT_APP_ENV=cec-prd REACT_APP_MAGNA_PROVIDER=Magna REACT_APP_MAGNA_GROUP_ID=68273225-9da4-4fa7-aea5-38e16ec471fe REACT_APP_OTA_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/ota_update diff --git a/.env.dev b/.env.dev index 84cee69..25f1da8 100644 --- a/.env.dev +++ b/.env.dev @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=https://dev-ota-admin.cloud.fiskerinc.com REACT_APP_AUTH_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/certificate +REACT_APP_ENV=dev REACT_APP_MAGNA_PROVIDER=Fisker-QA REACT_APP_MAGNA_GROUP_ID=efcc3025-e2d8-4212-8227-805c7be39d2c REACT_APP_OTA_SERVICE_URL=https://dev-gw.cloud.fiskerinc.com/ota_update diff --git a/.env.local b/.env.local index b51db82..3441980 100644 --- a/.env.local +++ b/.env.local @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=http://localhost:3000 REACT_APP_AUTH_SERVICE_URL=http://localhost/compute_auth REACT_APP_CERT_SERVICE_URL=http://localhost/certificate +REACT_APP_ENV=local REACT_APP_MAGNA_PROVIDER=Fisker-QA REACT_APP_MAGNA_GROUP_ID=efcc3025-e2d8-4212-8227-805c7be39d2c REACT_APP_OTA_SERVICE_URL=http://localhost/ota_update diff --git a/.env.prd b/.env.prd index 793c11b..f075c03 100644 --- a/.env.prd +++ b/.env.prd @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cloud.fiskerinc.com REACT_APP_AUTH_SERVICE_URL=https://gw.cloud.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://gw.cloud.fiskerinc.com/certificate +REACT_APP_ENV=prd REACT_APP_MAGNA_PROVIDER=Magna REACT_APP_MAGNA_GROUP_ID=68273225-9da4-4fa7-aea5-38e16ec471fe REACT_APP_OTA_SERVICE_URL=https://gw.cloud.fiskerinc.com/ota_update diff --git a/.env.stg b/.env.stg index ba137f8..ad05398 100644 --- a/.env.stg +++ b/.env.stg @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=https://stg-ota-admin.cloud.fiskerinc.com REACT_APP_AUTH_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/compute_auth REACT_APP_CERT_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/certificate +REACT_APP_ENV=stg REACT_APP_MAGNA_PROVIDER=Magna REACT_APP_MAGNA_GROUP_ID=68273225-9da4-4fa7-aea5-38e16ec471fe REACT_APP_OTA_SERVICE_URL=https://stg-gw.cloud.fiskerinc.com/ota_update diff --git a/.env.template b/.env.template index d20768a..af1d4e4 100644 --- a/.env.template +++ b/.env.template @@ -1,6 +1,7 @@ REACT_APP_AUTH_CALLBACK_URL=http://localhost:3000 REACT_APP_AUTH_SERVICE_URL=http://localhost/compute_auth REACT_APP_CERT_SERVICE_URL=http://localhost/certificate +REACT_APP_ENV=local REACT_APP_MAGNA_PROVIDER=Magna REACT_APP_MAGNA_GROUP_ID=68273225-9da4-4fa7-aea5-38e16ec471fe REACT_APP_OTA_SERVICE_URL=http://localhost/ota_update diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index fd02840..70011a4 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -9958,9 +9958,13 @@ exports[`App Route /vehicle-status authenticated 1`] = ` : 3

+ +

- Debug Mask + DebugMask :

diff --git a/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap b/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap index 267a4d4..30b2e69 100644 --- a/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap +++ b/src/components/Cars/Status/Details/__snapshots__/index.test.jsx.snap @@ -136,9 +136,13 @@ exports[`VehicleDetailsTab Render 1`] = ` : 3

+
+

- Debug Mask + DebugMask :

diff --git a/src/components/Cars/Status/Details/index.jsx b/src/components/Cars/Status/Details/index.jsx index 0679934..6307310 100644 --- a/src/components/Cars/Status/Details/index.jsx +++ b/src/components/Cars/Status/Details/index.jsx @@ -32,6 +32,9 @@ const MainForm = ({ vin }) => { providers, } = useUserContext(); + const ENV = process.env.REACT_APP_ENV; + const showDebugMask = (ENV === 'local' || ENV === 'dev' || ENV === 'stg') + useEffect(() => { (async () => { try { @@ -118,8 +121,12 @@ const MainForm = ({ vin }) => {

Filters: {vehicle.canbus.filters ? vehicle.canbus.filters.length : 0}

+ + )} + {showDebugMask && ( +

- Debug Mask: {vehicle.debug_mask} + DebugMask: {vehicle.debug_mask}

)} diff --git a/src/components/Cars/Status/__snapshots__/DetailsTab.test.jsx.snap b/src/components/Cars/Status/__snapshots__/DetailsTab.test.jsx.snap index 1975ba7..b89f23a 100644 --- a/src/components/Cars/Status/__snapshots__/DetailsTab.test.jsx.snap +++ b/src/components/Cars/Status/__snapshots__/DetailsTab.test.jsx.snap @@ -144,9 +144,13 @@ exports[`DetailsTab Render 1`] = ` : 3

+
+

- Debug Mask + DebugMask :

diff --git a/src/components/Cars/Status/__snapshots__/index.test.jsx.snap b/src/components/Cars/Status/__snapshots__/index.test.jsx.snap index e2731f0..0e24f78 100644 --- a/src/components/Cars/Status/__snapshots__/index.test.jsx.snap +++ b/src/components/Cars/Status/__snapshots__/index.test.jsx.snap @@ -272,6 +272,16 @@ exports[`CarStatus Render 1`] = ` :

+
+

+ + DebugMask + + : +

+
diff --git a/src/components/Cars/Update/__snapshots__/index.test.jsx.snap b/src/components/Cars/Update/__snapshots__/index.test.jsx.snap index a75b838..dc0b8dd 100644 --- a/src/components/Cars/Update/__snapshots__/index.test.jsx.snap +++ b/src/components/Cars/Update/__snapshots__/index.test.jsx.snap @@ -935,12 +935,12 @@ exports[`VehicleUpdate Render 1`] = ` class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth" >
diff --git a/src/components/Cars/Update/index.jsx b/src/components/Cars/Update/index.jsx index 510531f..aa7cc2b 100644 --- a/src/components/Cars/Update/index.jsx +++ b/src/components/Cars/Update/index.jsx @@ -46,7 +46,10 @@ const MainForm = () => { const [dataLoggerEnabled, setDataLoggerEnabled] = useState(false); const [maxMemBufferSize, setMaxMemBufferSize] = useState(0); const [maxDiskBufferSize, setMaxDiskBufferSize] = useState(0); - const [debugMask, setDebugMask] = useState(0); + const debugMaskEl = useRef(null); + + const ENV = process.env.REACT_APP_ENV; + const showDebugMask = (ENV === 'local' || ENV === 'dev' || ENV === 'stg') useEffect(() => { setTitle("Update Vehicle"); @@ -95,7 +98,9 @@ const MainForm = () => { setMaxDiskBufferSize(vehicle.canbus.max_disk_buffer_size ?? maxDiskBufferSize); } - setDebugMask(vehicle.debug_mask ?? debugMask); + if (showDebugMask) { + debugMaskEl.current.value = vehicle.debug_mask ?? "" + } // eslint-disable-next-line react-hooks/exhaustive-deps }, [vehicle]); @@ -120,10 +125,6 @@ const MainForm = () => { setMaxDiskBufferSize(event.target.value); } - const onDebugMaskChange = (event) => { - setDebugMask(event.target.value); - } - const onSubmit = async (event) => { try { event.preventDefault(); @@ -145,7 +146,7 @@ const MainForm = () => { max_mem_buffer_size: canbusEnabled ? parseInt(maxMemBufferSize) : 0, max_disk_buffer_size: canbusEnabled && dataLoggerEnabled ? parseInt(maxDiskBufferSize) : 0 }, - debug_mask: parseInt(debugMask) + debug_mask: debugMaskEl.current.value }; const result = await updateVehicle(vin, formData, token); @@ -388,17 +389,24 @@ const MainForm = () => { required fullWidth /> - + {showDebugMask && ( + + )}