CEC-1711-fix-digital-twin (#257)
* first commit * remove comments * resolve comments: * update snapshot
This commit is contained in:
@@ -91,6 +91,41 @@ exports[`DigitalTwinTab Render 1`] = `
|
|||||||
closed
|
closed
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="makeStyles-popupSection-0"
|
||||||
|
>
|
||||||
|
<h3>
|
||||||
|
Door Locks
|
||||||
|
</h3>
|
||||||
|
<p>
|
||||||
|
<b>
|
||||||
|
driver
|
||||||
|
</b>
|
||||||
|
:
|
||||||
|
Closed
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>
|
||||||
|
all
|
||||||
|
</b>
|
||||||
|
:
|
||||||
|
Locked
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="makeStyles-popupSection-0"
|
||||||
|
>
|
||||||
|
<h3>
|
||||||
|
Sunroof
|
||||||
|
</h3>
|
||||||
|
<p>
|
||||||
|
<b>
|
||||||
|
sunroof
|
||||||
|
</b>
|
||||||
|
:
|
||||||
|
closed
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="makeStyles-popupSection-0"
|
class="makeStyles-popupSection-0"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const mapOpenCloseState = (value) =>
|
|||||||
|
|
||||||
const DigitalTwin = (props) => {
|
const DigitalTwin = (props) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { battery, doors, location, trex_version, ip, updated, windows } = props;
|
const { battery, doors, location, trex_version, ip, updated, windows, sunroof, dbc, door_locks } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@@ -28,10 +28,41 @@ const DigitalTwin = (props) => {
|
|||||||
{Object.entries(doors).map(mapOpenCloseState)}
|
{Object.entries(doors).map(mapOpenCloseState)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{door_locks != null && (
|
||||||
|
<div className={classes.popupSection}>
|
||||||
|
<h3>Door Locks</h3>
|
||||||
|
{Object.entries(door_locks).map((value) => {
|
||||||
|
if (value[0] === "driver") {
|
||||||
|
return keyValueTemplate(value[0], value[1] ? "Open" : "Closed");
|
||||||
|
} else {
|
||||||
|
return keyValueTemplate(value[0], value[1] ?"Unlocked" : "Locked" );
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{windows != null && (
|
{windows != null && (
|
||||||
<div className={classes.popupSection}>
|
<div className={classes.popupSection}>
|
||||||
<h3>Windows</h3>
|
<h3>Windows</h3>
|
||||||
{Object.entries(windows).map(mapOpenCloseState)}
|
{Object.entries(windows).map((value) => {
|
||||||
|
if (value[1] === 0) {
|
||||||
|
return keyValueTemplate(value[0], "closed");
|
||||||
|
} else {
|
||||||
|
return keyValueTemplate(value[0], `${value[1]}% open`);
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{sunroof != null && (
|
||||||
|
<div className={classes.popupSection}>
|
||||||
|
<h3>Sunroof</h3>
|
||||||
|
{/* {Object.entries(sunroof).map(mapOpenCloseState)} */}
|
||||||
|
{Object.entries(sunroof).map((value) => {
|
||||||
|
if (value[1] === 0) {
|
||||||
|
return keyValueTemplate(value[0], "closed");
|
||||||
|
} else {
|
||||||
|
return keyValueTemplate(value[0], `${value[1]}% open`);
|
||||||
|
}
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{location != null && (
|
{location != null && (
|
||||||
@@ -61,6 +92,11 @@ const DigitalTwin = (props) => {
|
|||||||
{keyValueTemplate("Updated at", LocalDateTimeString(updated))}
|
{keyValueTemplate("Updated at", LocalDateTimeString(updated))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{dbc != null && (
|
||||||
|
<div className={classes.popupSection}>
|
||||||
|
{keyValueTemplate("DBC version", dbc)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user