CEC-6016: add trim to fleet (#523)

* CEC-6016: add trim to fleet

* update snapshot
This commit is contained in:
Tristan Timblin
2024-04-30 10:06:55 -07:00
committed by GitHub
parent a59a3df85e
commit 05c02dc1aa
8 changed files with 217 additions and 82 deletions

View File

@@ -191,7 +191,7 @@ exports[`FleetVehiclesTable Render 1`] = `
role="button"
tabindex="0"
>
VIN
Vehicle
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"

View File

@@ -23,18 +23,19 @@ import {
} from "../../../../Contexts/FleetContext";
import { useStatusContext } from "../../../../Contexts/StatusContext";
import { useUserContext } from "../../../../Contexts/UserContext";
import { VehicleProvider } from "../../../../Contexts/VehicleContext";
import SearchField from "../../../../Controls/SearchField";
import TableHeaderSortable from "../../../../Table/HeaderSortable";
import { useLocalStorage } from "../../../../useLocalStorage";
import ConnectedIcon from "../../../../Controls/ConnectedIcon";
import BulkActions from "../../../../BulkActions";
import Battery from "../../../../Battery";
import { VehicleTeaserController as VehicleTeaser } from "../../../../VehicleTeaser";
import useStyles from "../../../../useStyles";
const tableColumns = [
{
id: "vin",
label: "VIN",
id: "vehicle",
label: "Vehicle",
},
{
id: "trex_version",
@@ -213,54 +214,53 @@ const MainForm = ({ name }) => {
selectCount={selected.length}
rowCount={fleetVehicles.length}
/>
<TableBody>
{fleetVehicles && fleetVehicles.map((car) => {
const isSelected = selected.includes(car.vin);
return (car.vin && <TableRow key={"row" + car.vin}>
<TableCell padding="checkbox">
<Checkbox
checked={isSelected}
onChange={() => handleSelect(car.vin, !isSelected)}
/>
</TableCell>
<TableCell key={"cell" + car.vin} align="center">
{(car.connected || car.connectedHMI) &&
<ConnectedIcon
key={"icon" + car.vin}
connected={car.connected}
connectedHMI={car.connectedHMI}
style={{ marginRight: 3 }}
<VehicleProvider>
<TableBody>
{fleetVehicles && fleetVehicles.map((car) => {
const isSelected = selected.includes(car.vin);
return (car.vin && <TableRow key={"row" + car.vin}>
<TableCell padding="checkbox">
<Checkbox
checked={isSelected}
onChange={() => handleSelect(car.vin, !isSelected)}
/>
}
<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.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.vin}>
{car.car_update_status}
{car.car_update_progress > -1 && (
<LinearProgress variant="determinate" value={car.car_update_progress} />
)}
</TableCell>
<TableCell key={"cell5" + car.vin} align="left">
<Battery percent={car.charge} charge={car.charge_type} />
</TableCell>
<TableCell key={"cell6" + car.vin}>
{car.voltage > 0 && `${car.voltage}V`}
</TableCell>
<TableCell key={"cell7" + car.vin}>
{car.park ? "Yes" : "No"}
</TableCell>
</TableRow>
)
})}
</TableBody>
</TableCell>
<TableCell key={"cell" + car.vin} align="center">
<VehicleTeaser
vin={car.vin}
icc={car.connectedHMI}
trex={car.connected}
token={token}
/>
</TableCell>
<TableCell key={"cell2" + car.vin} align="center">{car.trex_version}</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.vin}>
{car.car_update_status}
{car.car_update_progress > -1 && (
<LinearProgress variant="determinate" value={car.car_update_progress} />
)}
</TableCell>
<TableCell key={"cell5" + car.vin} align="left">
<Battery percent={car.charge} charge={car.charge_type} />
</TableCell>
<TableCell key={"cell6" + car.vin}>
{car.voltage > 0 && `${car.voltage}V`}
</TableCell>
<TableCell key={"cell7" + car.vin}>
{car.park ? "Yes" : "No"}
</TableCell>
</TableRow>
)
})}
</TableBody>
</VehicleProvider>
<TableFooter>
<TableRow>
<TablePagination

View File

@@ -190,7 +190,7 @@ exports[`VehiclesTab Render 1`] = `
role="button"
tabindex="0"
>
VIN
Vehicle
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"