From e60e366cd8fc50b92b65e28a673f39bc634d616b Mon Sep 17 00:00:00 2001 From: John Wu <76966357+jwu-fisker@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:58:59 -0700 Subject: [PATCH 1/3] CEC-4678 Fix ERROR #42703 column "update_package_id" does not exist (#385) --- src/components/Controls/CarUpdatesTable/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Controls/CarUpdatesTable/index.jsx b/src/components/Controls/CarUpdatesTable/index.jsx index 1b21cf9..dd5be6b 100644 --- a/src/components/Controls/CarUpdatesTable/index.jsx +++ b/src/components/Controls/CarUpdatesTable/index.jsx @@ -32,7 +32,7 @@ const tableColumns = [ label: "ID", }, { - id: "update_package_id", + id: "update_manifest_id", label: "Name", }, { From 9b2fdc597636178bb5f955a27f3b09f7c39a9f25 Mon Sep 17 00:00:00 2001 From: Eduard Voronkin <116690094+eduardvoronkin@users.noreply.github.com> Date: Wed, 5 Jul 2023 17:35:07 -0700 Subject: [PATCH 2/3] CEC-4660 support ECU reset for all the ECUs (#381) * CEC-4660 support ECU reset for all the ECUs Dynamically request ECU list to display on "Remote Diagnostic Commands" tab. * dropdown * rename * fix semver * update semver --- .../Controls/SendDiagnosticCommand/index.jsx | 76 +++++++++++++------ 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/src/components/Controls/SendDiagnosticCommand/index.jsx b/src/components/Controls/SendDiagnosticCommand/index.jsx index 117583d..00d6cc2 100644 --- a/src/components/Controls/SendDiagnosticCommand/index.jsx +++ b/src/components/Controls/SendDiagnosticCommand/index.jsx @@ -1,7 +1,6 @@ import clsx from "clsx"; -import { Button, FormControl, InputLabel, Select, FormControlLabel, FormGroup } from "@material-ui/core"; -import Checkbox from '@mui/material/Checkbox'; +import { Button, FormControl, InputLabel, Select } from "@material-ui/core"; import React, { useEffect, useState } from "react"; import { useStatusContext } from "../../Contexts/StatusContext"; import { logger } from "../../../services/monitoring"; @@ -13,17 +12,17 @@ import { } from "../../Contexts/VehicleContext"; const commands = ["Reset"] -const ecus = ["TBOX"] const SendDiagnosticCommand = ({ vin, token, classes }) => { - const { getState, sendDiagnosticCommand } = useVehicleContext(); + const { getState, sendDiagnosticCommand, getECUs } = useVehicleContext(); const [carState, setCarState] = useState(null); + const [ecus, setEcus] = useState([]); const { setMessage } = useStatusContext(); const [currentCommand, setCurrentCommand] = useState(commands[0].toLowerCase()); - const [currentECUs] = useState([ecus[0]]); + const [currentECU, setCurrentECU] = useState(""); const changeCommandHandler = (e) => { setCurrentCommand(e.target.value); @@ -39,6 +38,19 @@ const SendDiagnosticCommand = ({ vin, token, classes }) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [vin]); + //Get ECUs + useEffect(() => { + (async () => { + if (!vin) return; + const result = await getECUs({ vin }, token) + sortECUs(result.data) + result.data.push({ ecu: "TBOX" }) + setCurrentECU(result.data[0].ecu) + setEcus(result.data) + })(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [vin]); + const getCarState = async () => { try { const result = await getState(token, vin); @@ -52,15 +64,18 @@ const SendDiagnosticCommand = ({ vin, token, classes }) => { const isOnline = () => { return carState && carState?.online; }; + const sortECUs = (ecus) => { + return ecus.sort((a, b) => { return a.ecu < b.ecu ? -1 : a.ecu > b.ecu ? 1 : 0 }) + } - const TREX_MIN_VER = "1.1.108"; - const isTBOXResetSupported = () => { - return !carState?.trex_version ? true : cmp(carState.trex_version, TREX_MIN_VER) === 1; + const TREX_MIN_VER = "1.1.141"; + const isRemoteResetSupported = () => { + return !carState?.trex_version ? true : cmp(carState.trex_version, TREX_MIN_VER) >= 0; }; const clickHandler = async (_) => { try { - await sendDiagnosticCommand([vin], { body: { command: currentCommand, ecus: currentECUs } }, token); + await sendDiagnosticCommand([vin], { command: currentCommand, ecu_name: currentECU }, token); setMessage(`Sent diagnostic command to ${vin}`); } catch (error) { setMessage(error.message); @@ -70,6 +85,33 @@ const SendDiagnosticCommand = ({ vin, token, classes }) => { return (