CEC-371 Update car ECUs display (#78)

* Clean up className styles
Update car status page to show update and ECUs

* Add update ecu version button
Show all ECUs on car status page
Only show car ecus for search
This commit is contained in:
John Wu
2021-08-18 09:14:13 -07:00
committed by GitHub
parent 3e66959521
commit d1815e2ff9
20 changed files with 1169 additions and 299 deletions

View File

@@ -17,19 +17,7 @@ export const useVehicleContext = () => ({
totalVehicles,
models,
years,
getVehicles: jest.fn(() => vehicles),
addVehicle: jest.fn(),
getModels: jest.fn(() => {
models = ["Ocean", "PEAR"];
}),
getYears: jest.fn(() => {
years = [2023, 2024];
}),
sendCommand: jest.fn((vins, command, parameters, token) => ({
vins,
command,
parameters,
})),
getConnections: jest.fn((vins, token) => {
const result = {};
@@ -39,9 +27,54 @@ export const useVehicleContext = () => ({
return result;
}),
getLocations: jest.fn().mockResolvedValue([
{ "altitude": 5, "longitude": 10, "latitude": 15, "vin": "TESTVIN123" },
])
getECUs: jest.fn(() => {
return {
data: [
{
boot_loader_version: "BLVERSION",
config: "CONFIG",
created: "2021-07-14T20:09:40.98187Z",
ecu: "ECUA",
fingerprint: "FINGERPRINT",
hw_version: "HWVERSION",
serial_number: "SERIAL",
sw_version: "SWVERSION",
updated: "2021-07-14T20:09:40.98187Z",
vendor: "VENDOR",
},
{
boot_loader_version: "BLVERSION",
config: "CONFIG",
created: "2021-07-14T20:09:40.98187Z",
ecu: "ECUB",
fingerprint: "FINGERPRINT",
hw_version: "HWVERSION",
serial_number: "SERIAL",
sw_version: "SWVERSION",
updated: "2021-07-14T20:09:40.98187Z",
vendor: "VENDOR",
},
],
total: 2,
};
}),
getModels: jest.fn(() => {
models = ["Ocean", "PEAR"];
}),
getLocations: jest
.fn()
.mockResolvedValue([
{ altitude: 5, longitude: 10, latitude: 15, vin: "TESTVIN123" },
]),
getVehicles: jest.fn(() => vehicles),
getYears: jest.fn(() => {
years = [2023, 2024];
}),
sendCommand: jest.fn((vins, command, parameters, token) => ({
vins,
command,
parameters,
})),
});
export const setBusy = (val) => {