CEC-3916 add max range (#296)

* CEC-3916 Add max range
Magna should not have access to self serve CAN page

* Max range
This commit is contained in:
John Wu
2023-03-17 14:50:23 -07:00
committed by GitHub
parent 8090bfdc6f
commit a4e774c8d4
3 changed files with 25 additions and 9 deletions

View File

@@ -55,6 +55,13 @@ exports[`DigitalTwinTab Render 1`] = `
: :
unknown unknown
</p> </p>
<p>
<b>
Max Range
</b>
:
577
</p>
</div> </div>
<div <div
class="makeStyles-popupSection-0" class="makeStyles-popupSection-0"
@@ -195,7 +202,7 @@ exports[`DigitalTwinTab Render 1`] = `
> >
<p> <p>
<b> <b>
Updated at Updated At
</b> </b>
: :
7/26/2022 12:26:38 AM 7/26/2022 12:26:38 AM
@@ -206,7 +213,7 @@ exports[`DigitalTwinTab Render 1`] = `
> >
<p> <p>
<b> <b>
DBC version DBC Version
</b> </b>
: :
d439abd3662dd20099f49dd8f43f7b145202e961caa2b5aba2c6154c8096348b d439abd3662dd20099f49dd8f43f7b145202e961caa2b5aba2c6154c8096348b

View File

@@ -26,10 +26,12 @@ const TabViews = [
{ {
label: "Details", label: "Details",
component: CarDetailsTab, component: CarDetailsTab,
rolesPerProvider: Permissions.FiskerMagnaRead,
}, },
{ {
label: "Car Updates", label: "Car Updates",
component: CarUpdatesTab, component: CarUpdatesTab,
rolesPerProvider: Permissions.FiskerMagnaRead,
}, },
{ {
label: "CAN Filters", label: "CAN Filters",
@@ -39,22 +41,27 @@ const TabViews = [
{ {
label: "Digital Twin", label: "Digital Twin",
component: DigitalTwinTab, component: DigitalTwinTab,
rolesPerProvider: Permissions.FiskerMagnaRead,
}, },
{ {
label: "CAN Signals", label: "CAN Signals",
component: CANSignalsTab, component: CANSignalsTab,
rolesPerProvider: Permissions.FiskerMagnaRead,
}, },
{ {
label: "T.Rex logs", label: "T.Rex logs",
component: TRexLogsTab, component: TRexLogsTab,
rolesPerProvider: Permissions.FiskerMagnaRead,
}, },
{ {
label: "ECUs", label: "ECUs",
component: ECUsTab, component: ECUsTab,
rolesPerProvider: Permissions.FiskerMagnaRead,
}, },
{ {
label: "Remote Commands", label: "Remote Commands",
component: RemoteCommandsTab, component: RemoteCommandsTab,
rolesPerProvider: Permissions.FiskerMagnaCreate,
}, },
{ {
label: "Fleets", label: "Fleets",
@@ -63,7 +70,8 @@ const TabViews = [
}, },
{ {
label: "CAN Signal Export", label: "CAN Signal Export",
component: SelfServeTab component: SelfServeTab,
rolesPerProvider: Permissions.FiskerRead,
} }
]; ];

View File

@@ -27,18 +27,19 @@ 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 } = props; const { battery, doors, location, trex_version, ip, updated, windows, misc_windows, sunroof, dbc_version, door_locks, vcu0x260, charging_metrics, max_range } = props;
return ( return (
<div> <div>
{!battery && !doors && !location && !windows && !vcu0x260 && !charging_metrics && ( {!battery && !doors && !location && !windows && !vcu0x260 && !charging_metrics && (
<p>No vehicle data to display.</p> <p>No vehicle data to display.</p>
)} )}
{battery && ( {(battery || max_range) && (
<div className={classes.popupSection}> <div className={classes.popupSection}>
<h3>Battery</h3> <h3>Battery</h3>
{keyValueTemplate("Percentage", `${battery.percent || 0}%`)} {keyValueTemplate("Percentage", `${battery?.percent || 0}%`)}
{keyValueTemplate("Total Mileage", `${battery.total_mileage_odometer || UNKNOWN}`)} {keyValueTemplate("Total Mileage", battery?.total_mileage_odometer || UNKNOWN)}
{keyValueTemplate("Max Range", max_range?.max_miles || UNKNOWN)}
</div> </div>
)} )}
{(vcu0x260 || charging_metrics) && ( {(vcu0x260 || charging_metrics) && (
@@ -113,12 +114,12 @@ const DigitalTwin = (props) => {
)} )}
{updated != null && ( {updated != null && (
<div className={classes.popupSection}> <div className={classes.popupSection}>
{keyValueTemplate("Updated at", LocalDateTimeString(updated))} {keyValueTemplate("Updated At", LocalDateTimeString(updated))}
</div> </div>
)} )}
{dbc_version != null && ( {dbc_version != null && (
<div className={classes.popupSection}> <div className={classes.popupSection}>
{keyValueTemplate("DBC version", dbc_version)} {keyValueTemplate("DBC Version", dbc_version)}
</div> </div>
)} )}
</div> </div>