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
</th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Part Number
</th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Serial
</th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Hardware
</th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
>
Vendor
</th>
<th
class="MuiTableCell-root MuiTableCell-head"
scope="col"
@@ -3044,50 +3026,6 @@ exports[`App Route /package-create authenticated 1`] = `
</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="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
class="MuiTableCell-root MuiTableCell-body"
>
@@ -3110,28 +3048,6 @@ exports[`App Route /package-create authenticated 1`] = `
</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="vendor"
name="vendor"
placeholder="Vendor"
type="text"
value=""
/>
</div>
</div>
</td>
<td
class="MuiTableCell-root MuiTableCell-body"
width="25"
@@ -3157,7 +3073,7 @@ exports[`App Route /package-create authenticated 1`] = `
>
<td
class="MuiTableCell-root MuiTableCell-body"
colspan="8"
colspan="5"
>
<table
class="MuiTable-root"
@@ -3370,7 +3286,7 @@ exports[`App Route /package-create authenticated 1`] = `
>
<td
class="MuiTableCell-root MuiTableCell-footer MuiTableCell-alignCenter"
colspan="8"
colspan="5"
>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-text"
@@ -4669,6 +4585,7 @@ exports[`App Route /package-status authenticated 1`] = `
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
style="vertical-align: top;"
>
<a
href="/vehicle-status/1G1FP87S3GN100062"
@@ -7299,29 +7216,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
</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"
>
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
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
@@ -7345,29 +7239,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
</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"
>
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
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
@@ -7391,52 +7262,6 @@ exports[`App Route /vehicle-status authenticated 1`] = `
</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"
>
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
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
scope="col"
@@ -7501,36 +7326,16 @@ exports[`App Route /vehicle-status authenticated 1`] = `
>
SWVERSION
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
BLVERSION
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
HWVERSION
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
VENDOR
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
CONFIG
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
FINGERPRINT
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
SERIAL
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
@@ -7547,44 +7352,22 @@ exports[`App Route /vehicle-status authenticated 1`] = `
>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
ECUB
</td>
/>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
SWVERSION
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
BLVERSION
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
HWVERSION
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
VENDOR
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
CONFIG
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
FINGERPRINT
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>
SERIAL
</td>
<td
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
>

View File

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

View File

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

View File

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

View File

@@ -44,8 +44,17 @@ let carUpdateLog = {
created: "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 }) => {
@@ -64,4 +73,5 @@ export const useCarUpdatesContext = () => ({
getVINUpdates: jest.fn(() => carUpdates),
startMonitor: jest.fn(),
stopMonitor: jest.fn(),
approveUpdate: jest.fn(),
});

View File

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

View File

@@ -31,28 +31,19 @@ export const useVehicleContext = () => ({
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,

View File

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

View File

@@ -153,6 +153,28 @@ exports[`CarUpdateStatusTable Render 1`] = `
class="MuiTableCell-root MuiTableCell-body MuiTableCell-alignCenter"
/>
</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>
<tfoot
class="MuiTableFooter-root"
@@ -223,7 +245,7 @@ exports[`CarUpdateStatusTable Render 1`] = `
<p
class="MuiTypography-root MuiTablePagination-caption MuiTypography-body2 MuiTypography-colorInherit"
>
1-2 of 2
1-3 of 3
</p>
<div
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",
required: true,
},
{
label: "Part Number",
field: "part_number",
},
{
label: "Serial",
field: "serial_number",
},
{
label: "Hardware",
field: "hw_version",
},
{
label: "Vendor",
field: "vendor",
},
{
label: "",
delete: true,
@@ -74,7 +62,7 @@ const ManifestECUList = () => {
</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={8} align="center">
<TableCell colSpan={5} align="center">
<Button onClick={addECU}>Add ECU</Button>
</TableCell>
</TableRow>

View File

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

View File

@@ -11,7 +11,9 @@ const ECUFileList = (files) => {
return (
<ul>
{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>
);
@@ -23,7 +25,7 @@ const ECUList = (ecus) => {
<ul>
{ecus.map((ecu) => (
<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 />
{ECUFileList(ecu.files)}
</li>

View File

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

View File

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

View File

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

View File

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