CEC-1256/CEC-1330 data logger for vehicles/fleets and details tabs for vehicles/fleets (#136)

* forms for fleet can filters

* unit tests for fleet filters

* removing warnings

* updating regex

* added fleet details page

* fleet pages

* smoothed out bugs

* fleets done

* working update, delete vehicles

* finished mocks, still need snapshots and context tests

* contexts done

* snapshot tests

* updating code smells

* smells
This commit is contained in:
Drew Taylor
2022-04-14 18:11:22 -07:00
committed by GitHub
parent afa3c1e529
commit 07f77cabdb
56 changed files with 5854 additions and 2208 deletions

View File

@@ -5,6 +5,8 @@ const data = [
model: "Ocean",
trim: "Basic",
ecu_list: "ECUA 2.0.0, ECUB 2.1.1",
log_level: "info",
canbus: { enabled: true, data_logger_enabled: true, max_mem_buffer_size: 1, max_disk_buffer_size: 2 },
},
{ vin: "1G1FP87S3GN100062" },
{ vin: "1HGCG325XYA062256", year: 2021 },
@@ -34,11 +36,16 @@ const ecusData = [
];
const vehiclesAPI = {
addVehicle: async (vehicle, token) => {
addVehicle: async (vehicle) => {
data.push(vehicle);
return vehicle;
},
getConnections: async (vins, token) => {
deleteVehicle: async (vin) => {
const index = data.findIndex(element => element.vin === vin);
if (index >= 0) data.splice(index, 1);
return vin;
},
getConnections: async (vins) => {
const result = {};
vins.forEach((vin) => {
@@ -47,10 +54,10 @@ const vehiclesAPI = {
return result;
},
getECUs: async (vin, token) => {
getECUs: async () => {
return { data: ecusData, total: ecusData.length };
},
getModels: async (token) => {
getModels: async () => {
return {
data: ["Ocean", "Pear"],
};
@@ -60,21 +67,30 @@ const vehiclesAPI = {
.mockResolvedValue([
{ altitude: 5, longitude: 10, latitude: 15, vin: "TESTVIN123" },
]),
getVehicles: async (search, token) => {
getVehicle: async (vin) => {
const index = data.findIndex(element => element.vin === vin);
return data[index];
},
getVehicles: async () => {
return { data };
},
getYears: async (token) => {
getYears: async () => {
return {
data: [2021, 2022],
};
},
sendCommand: async (vin, command, parameters, token) => {
sendCommand: async (vin, command, parameters) => {
return {
vin,
command,
parameters,
};
},
updateVehicle: async (vin, vehicle) => {
const index = data.findIndex(element => element.vin === vin);
if (index >= 0) data[index] = vehicle;
return vehicle;
}
};
export default vehiclesAPI;