CEC-4883: update api shape and display trex version on fleets (#418)

This commit is contained in:
Tristan Timblin
2023-08-17 14:08:57 -07:00
committed by GitHub
parent 0c05663443
commit f4d021b658
7 changed files with 96 additions and 14 deletions

View File

@@ -113,18 +113,20 @@ export const FleetProvider = ({ children }) => {
throw new Error(`Get fleet vehicles error. ${result.message}`);
}
const connectionsResult = await vehiclesAPI.getConnections({ "VINs": result.data }, token)
const vins = result.data.map(vehicle => vehicle.vin);
const connectionsResult = await vehiclesAPI.getConnections({ "VINs": vins }, token)
if (result.error) {
setFleetVehicles([])
throw new Error(`Get vehicles connections error. ${result.message}`);
}
var cars = []
result.data.forEach((vin) => {
result.data.forEach((vehicle) => {
cars.push({
vin: vin,
connected: connectionsResult[vin] || false,
connectedHMI: connectionsResult[`2:${vin}`] || false
vin: vehicle.vin,
connected: connectionsResult[vehicle.vin] || false,
connectedHMI: connectionsResult[`2:${vehicle.vin}`] || false,
trex_version: vehicle.carstate?.trex_version || "",
})
})