CEC-1050 New manifest format (#117)

* CEC-1050 Manifest changes

* Fix delete bug

* Add approve update button

* Code smell

* Remove update approval
This commit is contained in:
John Wu
2022-03-01 16:56:25 -08:00
committed by GitHub
parent a858b842c6
commit 3b9252097a
17 changed files with 155 additions and 346 deletions

View File

@@ -2484,30 +2484,12 @@ exports[`App Route /package-create authenticated 1`] = `
> >
Version Version
</th> </th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Part Number
</th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Serial
</th>
<th <th
class="MuiTableCell-root MuiTableCell-head" class="MuiTableCell-root MuiTableCell-head"
scope="col" scope="col"
> >
Hardware Hardware
</th> </th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Vendor
</th>
<th <th
class="MuiTableCell-root MuiTableCell-head" class="MuiTableCell-root MuiTableCell-head"
scope="col" scope="col"
@@ -3044,50 +3026,6 @@ exports[`App Route /package-create authenticated 1`] = `
</div> </div>
</div> </div>
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body"
>
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
requried="false"
>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
>
<input
aria-invalid="false"
class="MuiInputBase-input MuiInput-input"
id="part_number"
name="part_number"
placeholder="Part Number"
type="text"
value=""
/>
</div>
</div>
</td>
<td
class="MuiTableCell-root MuiTableCell-body"
>
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
requried="false"
>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
>
<input
aria-invalid="false"
class="MuiInputBase-input MuiInput-input"
id="serial_number"
name="serial_number"
placeholder="Serial"
type="text"
value=""
/>
</div>
</div>
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body" class="MuiTableCell-root MuiTableCell-body"
> >
@@ -3110,28 +3048,6 @@ exports[`App Route /package-create authenticated 1`] = `
</div> </div>
</div> </div>
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body"
>
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
requried="false"
>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
>
<input
aria-invalid="false"
class="MuiInputBase-input MuiInput-input"
id="vendor"
name="vendor"
placeholder="Vendor"
type="text"
value=""
/>
</div>
</div>
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body" class="MuiTableCell-root MuiTableCell-body"
width="25" width="25"
@@ -3157,7 +3073,7 @@ exports[`App Route /package-create authenticated 1`] = `
> >
<td <td
class="MuiTableCell-root MuiTableCell-body" class="MuiTableCell-root MuiTableCell-body"
colspan="8" colspan="5"
> >
<table <table
class="MuiTable-root" class="MuiTable-root"
@@ -3370,7 +3286,7 @@ exports[`App Route /package-create authenticated 1`] = `
> >
<td <td
class="MuiTableCell-root MuiTableCell-footer MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-footer MuiTableCell-alignCenter"
colspan="8" colspan="5"
> >
<button <button
class="MuiButtonBase-root MuiButton-root MuiButton-text" class="MuiButtonBase-root MuiButton-root MuiButton-text"
@@ -4669,6 +4585,7 @@ exports[`App Route /package-status authenticated 1`] = `
</td> </td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
style="vertical-align: top;"
> >
<a <a
href="/vehicle-status/1G1FP87S3GN100062" href="/vehicle-status/1G1FP87S3GN100062"
@@ -7299,29 +7216,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
</svg> </svg>
</span> </span>
</th> </th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiTableSortLabel-root"
role="button"
tabindex="0"
>
BL Version
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th <th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col" scope="col"
@@ -7345,29 +7239,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
</svg> </svg>
</span> </span>
</th> </th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Vendor
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th <th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col" scope="col"
@@ -7391,52 +7262,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
</svg> </svg>
</span> </span>
</th> </th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Fingerprint
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiTableSortLabel-root"
role="button"
tabindex="0"
>
Serial
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"
/>
</svg>
</span>
</th>
<th <th
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col" scope="col"
@@ -7501,36 +7326,16 @@ exports[`App Route /vehicle-status authenticated 1`] = `
> >
SWVERSION SWVERSION
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
BLVERSION
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
HWVERSION HWVERSION
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
VENDOR
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
CONFIG CONFIG
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
FINGERPRINT
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
SERIAL
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
@@ -7547,44 +7352,22 @@ exports[`App Route /vehicle-status authenticated 1`] = `
> >
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> />
ECUB
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
SWVERSION SWVERSION
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
BLVERSION
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
HWVERSION HWVERSION
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
VENDOR
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >
CONFIG CONFIG
</td> </td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
FINGERPRINT
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
SERIAL
</td>
<td <td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
> >

View File

@@ -22,32 +22,20 @@ const tableColumns = [
label: "ECU", label: "ECU",
}, },
{ {
id: "sw_version", id: "version",
label: "SW Version", label: "SW Version",
}, },
{
id: "boot_loader_version",
label: "BL Version",
},
{ {
id: "hw_version", id: "hw_version",
label: "HW Version", label: "HW Version",
}, },
{ {
id: "vendor", id: "mode",
label: "Vendor", label: "Flash Mode",
}, },
{ {
id: "config", id: "self_download",
label: "Config", label: "Flash Mode",
},
{
id: "fingerprint",
label: "Fingerprint",
},
{
id: "serial_number",
label: "Serial",
}, },
{ {
id: "created_at", id: "created_at",
@@ -133,13 +121,10 @@ const CarECUs = ({ vin, token }) => {
{ecus.map((row) => ( {ecus.map((row) => (
<TableRow key={row.ecu}> <TableRow key={row.ecu}>
<TableCell align="center">{row.ecu}</TableCell> <TableCell align="center">{row.ecu}</TableCell>
<TableCell align="center">{row.sw_version}</TableCell> <TableCell align="center">{row.version}</TableCell>
<TableCell align="center">{row.boot_loader_version}</TableCell>
<TableCell align="center">{row.hw_version}</TableCell> <TableCell align="center">{row.hw_version}</TableCell>
<TableCell align="center">{row.vendor}</TableCell> <TableCell align="center">{row.mode}</TableCell>
<TableCell align="center">{row.config}</TableCell> <TableCell align="center">{row.self_download}</TableCell>
<TableCell align="center">{row.fingerprint}</TableCell>
<TableCell align="center">{row.serial_number}</TableCell>
<TableCell align="center"> <TableCell align="center">
{LocalDateTimeString(row.created)} {LocalDateTimeString(row.created)}
</TableCell> </TableCell>

View File

@@ -22,13 +22,10 @@ const checkExistingManifest = async (data, token) => {
const ECUTemplate = { const ECUTemplate = {
name: "AGS", name: "AGS",
part_number: "",
version: "", version: "",
serial_number: "",
hw_version: "", hw_version: "",
vendor: "", configuration_mask: "",
configuration: "", configuration: "",
fingerprint: "",
files: [], files: [],
manifest_id: 0, manifest_id: 0,
}; };

View File

@@ -46,16 +46,16 @@ export const ManifestsProvider = ({ children }) => {
const deleteManifest = async (package_id, token) => { const deleteManifest = async (package_id, token) => {
let result; let result;
const index = manifests.findIndex((element) => {
return element.id === package_id;
});
manifests.splice(index, 1);
try { try {
setBusy(true); setBusy(true);
result = await api.deleteManifest(package_id, token); result = await api.deleteManifest(package_id, token);
if (result.error) if (result.error)
throw new Error(`Delete manifest error. ${result.message}`); throw new Error(`Delete manifest error. ${result.message}`);
const index = manifests.findIndex((element) => {
return element.id === package_id;
});
manifests.splice(index, 1);
} finally { } finally {
setBusy(false); setBusy(false);
} }

View File

@@ -44,8 +44,17 @@ let carUpdateLog = {
created: "2021-08-23T17:06:38.030052Z", created: "2021-08-23T17:06:38.030052Z",
updated: "2021-08-23T17:06:38.030052Z", updated: "2021-08-23T17:06:38.030052Z",
}, },
{
id: 88,
carupdate_id: 284,
status: "install_approval_await",
error_code: 0,
info: "TEST",
created: "2021-08-23T17:06:38.030052Z",
updated: "2021-08-23T17:06:38.030052Z",
},
], ],
total: 2, total: 3,
}; };
export const CarUpdatesProvider = ({ children }) => { export const CarUpdatesProvider = ({ children }) => {
@@ -64,4 +73,5 @@ export const useCarUpdatesContext = () => ({
getVINUpdates: jest.fn(() => carUpdates), getVINUpdates: jest.fn(() => carUpdates),
startMonitor: jest.fn(), startMonitor: jest.fn(),
stopMonitor: jest.fn(), stopMonitor: jest.fn(),
approveUpdate: jest.fn(),
}); });

View File

@@ -7,13 +7,8 @@ let ecus = [
{ {
data_id: 0, data_id: 0,
name: "AGS", name: "AGS",
part_number: "",
version: "", version: "",
serial_number: "",
hw_version: "", hw_version: "",
vendor: "",
configuration: "",
fingerprint: "",
manifest_id: 0, manifest_id: 0,
files: [ files: [
{ {
@@ -21,6 +16,8 @@ let ecus = [
order: 0, order: 0,
offset: "0", offset: "0",
checksum: "", checksum: "",
self_download: false,
mode: "D",
type: 1, type: 1,
}, },
], ],

View File

@@ -31,28 +31,19 @@ export const useVehicleContext = () => ({
return { return {
data: [ data: [
{ {
boot_loader_version: "BLVERSION",
config: "CONFIG", config: "CONFIG",
created: "2021-07-14T20:09:40.98187Z", created: "2021-07-14T20:09:40.98187Z",
ecu: "ECUA", ecu: "ECUA",
fingerprint: "FINGERPRINT",
hw_version: "HWVERSION", hw_version: "HWVERSION",
serial_number: "SERIAL",
sw_version: "SWVERSION", sw_version: "SWVERSION",
updated: "2021-07-14T20:09:40.98187Z", updated: "2021-07-14T20:09:40.98187Z",
vendor: "VENDOR",
}, },
{ {
boot_loader_version: "BLVERSION",
config: "CONFIG", config: "CONFIG",
created: "2021-07-14T20:09:40.98187Z", created: "2021-07-14T20:09:40.98187Z",
ecu: "ECUB",
fingerprint: "FINGERPRINT",
hw_version: "HWVERSION", hw_version: "HWVERSION",
serial_number: "SERIAL",
sw_version: "SWVERSION", sw_version: "SWVERSION",
updated: "2021-07-14T20:09:40.98187Z", updated: "2021-07-14T20:09:40.98187Z",
vendor: "VENDOR",
}, },
], ],
total: 2, total: 2,

View File

@@ -24,30 +24,14 @@ const tableColumns = [
id: "sw_version", id: "sw_version",
label: "SW Version", label: "SW Version",
}, },
{
id: "boot_loader_version",
label: "BL Version",
},
{ {
id: "hw_version", id: "hw_version",
label: "HW Version", label: "HW Version",
}, },
{
id: "vendor",
label: "Vendor",
},
{ {
id: "config", id: "config",
label: "Config", label: "Config",
}, },
{
id: "fingerprint",
label: "Fingerprint",
},
{
id: "serial_number",
label: "Serial",
},
{ {
id: "created_at", id: "created_at",
label: "Created", label: "Created",
@@ -128,16 +112,12 @@ const CarECUsTable = ({ vin, token, classes }) => {
onSortRequest={handleSort} onSortRequest={handleSort}
/> />
<TableBody> <TableBody>
{ecus.map((row) => ( {ecus.map((row, i) => (
<TableRow key={row.ecu}> <TableRow key={row.ecu + i}>
<TableCell align="center">{row.ecu}</TableCell> <TableCell align="center">{row.ecu}</TableCell>
<TableCell align="center">{row.sw_version}</TableCell> <TableCell align="center">{row.sw_version}</TableCell>
<TableCell align="center">{row.boot_loader_version}</TableCell>
<TableCell align="center">{row.hw_version}</TableCell> <TableCell align="center">{row.hw_version}</TableCell>
<TableCell align="center">{row.vendor}</TableCell>
<TableCell align="center">{row.config}</TableCell> <TableCell align="center">{row.config}</TableCell>
<TableCell align="center">{row.fingerprint}</TableCell>
<TableCell align="center">{row.serial_number}</TableCell>
<TableCell align="center"> <TableCell align="center">
{LocalDateTimeString(row.created)} {LocalDateTimeString(row.created)}
</TableCell> </TableCell>

View File

@@ -153,6 +153,28 @@ exports[`CarUpdateStatusTable Render 1`] = `
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter" class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
/> />
</tr> </tr>
<tr
class="MuiTableRow-root"
>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
8/23/2021 5:06:38 PM
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
install_approval_await
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
TEST
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
/>
</tr>
</tbody> </tbody>
<tfoot <tfoot
class="MuiTableFooter-root" class="MuiTableFooter-root"
@@ -223,7 +245,7 @@ exports[`CarUpdateStatusTable Render 1`] = `
<p <p
class="MuiTypography-root MuiTablePagination-caption MuiTypography-body2 MuiTypography-colorInherit" class="MuiTypography-root MuiTablePagination-caption MuiTypography-body2 MuiTypography-colorInherit"
> >
1-2 of 2 1-3 of 3
</p> </p>
<div <div
class="MuiTablePagination-actions" class="MuiTablePagination-actions"

View File

@@ -0,0 +1,34 @@
import React from "react";
import { Select } from "@material-ui/core";
const ManifestECUFlashModes = (props) => {
const changeHandler = (e) => {
if (!props.changeHandler) return;
props.changeHandler(e);
};
return (
<Select
id={props.id}
native
variant="outlined"
value={props.value}
onChange={changeHandler}
>
{FlashModeTypes.map((item, index) => (
<option key={index} value={item[0]}>
{item[1]}
</option>
))}
</Select>
);
};
export default ManifestECUFlashModes;
const FlashModeTypes = [
["A", "Mode A"],
["D", "Mode D"],
["SELF", "Self"],
];

View File

@@ -31,22 +31,10 @@ const options = [
field: "version", field: "version",
required: true, required: true,
}, },
{
label: "Part Number",
field: "part_number",
},
{
label: "Serial",
field: "serial_number",
},
{ {
label: "Hardware", label: "Hardware",
field: "hw_version", field: "hw_version",
}, },
{
label: "Vendor",
field: "vendor",
},
{ {
label: "", label: "",
delete: true, delete: true,
@@ -74,7 +62,7 @@ const ManifestECUList = () => {
</TableBody> </TableBody>
<TableFooter> <TableFooter>
<TableRow> <TableRow>
<TableCell colSpan={8} align="center"> <TableCell colSpan={5} align="center">
<Button onClick={addECU}>Add ECU</Button> <Button onClick={addECU}>Add ECU</Button>
</TableCell> </TableCell>
</TableRow> </TableRow>

View File

@@ -116,11 +116,18 @@ Object {
ECUs: ECUs:
<ul> <ul>
<li> <li>
ICC, Part: BBBBBB, Version: 1000 ICC, SW Version: 1000, HW Version: undefined, Mode: undefined
<br /> <br />
<ul> <ul>
<li> <li>
ODX Data: LARGE.jpg <a
href="https://upload-dev.fiskerdps.com/92bbc448-99c8-4851-91ad-f8042e4deb49/LARGE.jpg"
>
LARGE.jpg
</a>
[
b0cda514c94080b4
]
</li> </li>
</ul> </ul>
</li> </li>
@@ -154,11 +161,18 @@ Object {
ECUs: ECUs:
<ul> <ul>
<li> <li>
ICC, Part: BBBBBB, Version: 1000 ICC, SW Version: 1000, HW Version: undefined, Mode: undefined
<br /> <br />
<ul> <ul>
<li> <li>
ODX Data: LARGE.jpg <a
href="https://upload-dev.fiskerdps.com/92bbc448-99c8-4851-91ad-f8042e4deb49/LARGE.jpg"
>
LARGE.jpg
</a>
[
b0cda514c94080b4
]
</li> </li>
</ul> </ul>
</li> </li>

View File

@@ -11,7 +11,9 @@ const ECUFileList = (files) => {
return ( return (
<ul> <ul>
{files.map((file) => ( {files.map((file) => (
<li key={file.filename}>{`${file.type}: ${file.filename} `}</li> <li key={file.filename}>
<a href={file.url}>{file.filename}</a> [{file.file_id}]
</li>
))} ))}
</ul> </ul>
); );
@@ -23,7 +25,7 @@ const ECUList = (ecus) => {
<ul> <ul>
{ecus.map((ecu) => ( {ecus.map((ecu) => (
<li key={ecu.name}> <li key={ecu.name}>
{`${ecu.name}, Part: ${ecu.part_number}, Version: ${ecu.version}`} {`${ecu.name}, SW Version: ${ecu.version}, HW Version: ${ecu.hw_version}, Mode: ${ecu.mode}`}
<br /> <br />
{ECUFileList(ecu.files)} {ECUFileList(ecu.files)}
</li> </li>

View File

@@ -140,7 +140,7 @@ const MainForm = () => {
{carUpdates.map((row) => ( {carUpdates.map((row) => (
<TableRow key={row.id}> <TableRow key={row.id}>
<TableCell align="center">{row.id}</TableCell> <TableCell align="center">{row.id}</TableCell>
<TableCell align="center"> <TableCell align="center" style={{ verticalAlign: "top" }}>
<Link to={`/vehicle-status/${row.vin}`}>{row.vin}</Link> <Link to={`/vehicle-status/${row.vin}`}>{row.vin}</Link>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">

View File

@@ -5,6 +5,10 @@ const manifestsAPI = {
return data; return data;
}, },
deleteManifest: async (manifest_id, token) => {
return { message: "OK" };
},
getPackages: async (search, token) => { getPackages: async (search, token) => {
return { return {
data: [ data: [

View File

@@ -1,5 +1,3 @@
const updatesAPI = { const updatesAPI = {
createCarUpdates: async (data, token) => { createCarUpdates: async (data, token) => {
if (!data.id) data.id = 0; if (!data.id) data.id = 0;

View File

@@ -1,6 +1,11 @@
const data = [ const data = [
{ vin: "3C4PDCBG0ET127145", year: 2021, model: "Ocean", trim: "Basic", ecu_list: "ECUA 2.0.0, ECUB 2.1.1" }, {
vin: "3C4PDCBG0ET127145",
year: 2021,
model: "Ocean",
trim: "Basic",
ecu_list: "ECUA 2.0.0, ECUB 2.1.1",
},
{ vin: "1G1FP87S3GN100062" }, { vin: "1G1FP87S3GN100062" },
{ vin: "1HGCG325XYA062256", year: 2021 }, { vin: "1HGCG325XYA062256", year: 2021 },
{ vin: "1J4GZ78YXWC160024", year: 2021, model: "Ocean" }, { vin: "1J4GZ78YXWC160024", year: 2021, model: "Ocean" },
@@ -9,30 +14,23 @@ const data = [
{ vin: "1G11C5SL9FF153507", year: 2021, model: "Ocean", trim: "Basic" }, { vin: "1G11C5SL9FF153507", year: 2021, model: "Ocean", trim: "Basic" },
]; ];
const ecusData = [{ const ecusData = [
"boot_loader_version": "BLVERSION", {
"config": "CONFIG", config: "CONFIG",
"created": "2021-07-14T20:09:40.98187Z", created: "2021-07-14T20:09:40.98187Z",
"ecu": "ECUA", ecu: "ECUA",
"fingerprint": "FINGERPRINT", hw_version: "HWVERSION",
"hw_version": "HWVERSION", sw_version: "SWVERSION",
"serial_number": "SERIAL", updated: "2021-07-14T20:09:40.98187Z",
"sw_version": "SWVERSION",
"updated": "2021-07-14T20:09:40.98187Z",
"vendor": "VENDOR",
}, },
{ {
"boot_loader_version": "BLVERSION", config: "CONFIG",
"config": "CONFIG", created: "2021-07-14T20:09:40.98187Z",
"created": "2021-07-14T20:09:40.98187Z", ecu: "ECUB",
"ecu": "ECUB", hw_version: "HWVERSION",
"fingerprint": "FINGERPRINT", sw_version: "SWVERSION",
"hw_version": "HWVERSION", updated: "2021-07-14T20:09:40.98187Z",
"serial_number": "SERIAL", },
"sw_version": "SWVERSION",
"updated": "2021-07-14T20:09:40.98187Z",
"vendor": "VENDOR",
}
]; ];
const vehiclesAPI = { const vehiclesAPI = {
@@ -43,24 +41,28 @@ const vehiclesAPI = {
getConnections: async (vins, token) => { getConnections: async (vins, token) => {
const result = {}; const result = {};
vins.forEach(vin => { vins.forEach((vin) => {
result[vin] = true; result[vin] = true;
}); });
return result; return result;
}, },
getECUs: async (vin, token) => { getECUs: async (vin, token) => {
return { data: ecusData, total: ecusData.length}; return { data: ecusData, total: ecusData.length };
}, },
getModels: async (token) => { getModels: async (token) => {
return { return {
data: ["Ocean", "Pear"], data: ["Ocean", "Pear"],
}; };
}, },
getLocations: jest.fn().mockResolvedValue([ getLocations: jest
{ "altitude": 5, "longitude": 10, "latitude": 15, "vin": "TESTVIN123" }, .fn()
]), .mockResolvedValue([
getVehicles: async (search, token) => { return { data }; }, { altitude: 5, longitude: 10, latitude: 15, vin: "TESTVIN123" },
]),
getVehicles: async (search, token) => {
return { data };
},
getYears: async (token) => { getYears: async (token) => {
return { return {
data: [2021, 2022], data: [2021, 2022],
@@ -68,8 +70,10 @@ const vehiclesAPI = {
}, },
sendCommand: async (vin, command, parameters, token) => { sendCommand: async (vin, command, parameters, token) => {
return { return {
vin, command, parameters vin,
} command,
parameters,
};
}, },
}; };