CEC-5182: add car update status to fleet (#466)

This commit is contained in:
Tristan Timblin
2023-10-13 10:09:49 -07:00
committed by GitHub
parent 0f1886463e
commit db0d3dd319
10 changed files with 292 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import {
Grid,
LinearProgress,
Table,
TableBody,
TableCell,
@@ -38,6 +39,14 @@ const tableColumns = [
id: "trex_version",
label: "T.REX Version",
},
{
id: "car_update",
label: "Car Update",
},
{
id: "car_update_status",
label: "Car Update Status",
},
{
id: "",
label: "Actions",
@@ -58,6 +67,7 @@ const MainForm = ({ name }) => {
const {
fleetVehicles,
totalFleetVehicles,
watchFleetVehicles,
getFleetVehicles,
deleteFleetVehicle,
} = useFleetContext();
@@ -87,11 +97,15 @@ const MainForm = ({ name }) => {
},
token
);
watchFleetVehicles.start({ token });
} catch (e) {
setMessage(e.message);
logger.warn(e.stack);
}
})();
return () => {
watchFleetVehicles.end();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [token, pageIndex, pageSize, orderBy, order, search]);
@@ -209,7 +223,20 @@ const MainForm = ({ name }) => {
<Link key={"link" + car.vin} to={`/vehicle-status/${car.vin}`}>{car.vin}</Link>
</TableCell>
<TableCell key={"cell2" + car.vin} align="center">{car.trex_version}</TableCell>
<TableCell key={"cell3" + car.vin} align="center">{Actions(car.vin)}</TableCell>
<TableCell key={"cell3" + car.car_update_name}>
<Tooltip key={"cell3tooltip"} title={`${car.car_update_id} / ${car.car_update_type}`}>
<Link to={`/vehicle-status/${car.vin}/${car.car_update_id}`} className={classes.truncateCell}>
{car.car_update_name}
</Link>
</Tooltip>
</TableCell>
<TableCell key={"cell4" + car.car_update_status}>
{car.car_update_status}
{car.car_update_progress > -1 && (
<LinearProgress variant="determinate" value={car.car_update_progress} />
)}
</TableCell>
<TableCell key={"cell5" + car.vin} align="center">{Actions(car.vin)}</TableCell>
</TableRow>
)
))}