CEC-4214 - Display new digital twin property (#332)

This commit is contained in:
Paul Adamsen
2023-05-15 19:41:26 -04:00
committed by GitHub
parent e41bd97b6f
commit a8972e2f11
3 changed files with 21 additions and 2 deletions

View File

@@ -219,6 +219,17 @@ exports[`DigitalTwinTab Render 1`] = `
d439abd3662dd20099f49dd8f43f7b145202e961caa2b5aba2c6154c8096348b d439abd3662dd20099f49dd8f43f7b145202e961caa2b5aba2c6154c8096348b
</p> </p>
</div> </div>
<div
class="makeStyles-popupSection-0"
>
<p>
<b>
Vehicle Speed
</b>
:
77.7
</p>
</div>
</div> </div>
<div <div
style="width: 100vh;" style="width: 100vh;"

View File

@@ -73,6 +73,9 @@ let vehicleState = {
dbc_version: "d439abd3662dd20099f49dd8f43f7b145202e961caa2b5aba2c6154c8096348b", dbc_version: "d439abd3662dd20099f49dd8f43f7b145202e961caa2b5aba2c6154c8096348b",
ip: "172.20.0.17:49850", ip: "172.20.0.17:49850",
updated: "2022-07-26T00:26:38.880381Z", updated: "2022-07-26T00:26:38.880381Z",
vehicle_speed: {
speed: 77.7,
},
}, },
}; };
@@ -144,7 +147,7 @@ export const useVehicleContext = () => ({
getModels: jest.fn(() => { getModels: jest.fn(() => {
models = ["Ocean", "PEAR"]; models = ["Ocean", "PEAR"];
}), }),
getState: jest.fn(() => vehicleState), getState: jest.fn().mockResolvedValue(vehicleState),
getYears: jest.fn(() => { getYears: jest.fn(() => {
years = [2023, 2024]; years = [2023, 2024];
}), }),

View File

@@ -27,7 +27,7 @@ const windowState = (value) => {
const DigitalTwin = (props) => { const DigitalTwin = (props) => {
const classes = useStyles(); const classes = useStyles();
const { battery, doors, location, trex_version, ip, updated, windows, misc_windows, sunroof, dbc_version, door_locks, vcu0x260, charging_metrics, max_range } = props; const { battery, doors, location, trex_version, ip, updated, windows, misc_windows, sunroof, dbc_version, door_locks, vcu0x260, charging_metrics, max_range, vehicle_speed } = props;
return ( return (
<div> <div>
@@ -122,6 +122,11 @@ const DigitalTwin = (props) => {
{keyValueTemplate("DBC Version", dbc_version)} {keyValueTemplate("DBC Version", dbc_version)}
</div> </div>
)} )}
{vehicle_speed && (
<div className={classes.popupSection}>
{keyValueTemplate("Vehicle Speed", vehicle_speed.speed)}
</div>
)}
</div> </div>
); );
}; };