CEC-6070: custom dtc ttl (#538)

* CEC-6070: custom dtc ttl

* CEC-6070: Removed 1 and 6 hours dtc ttl and added 72 hours ttl

* CEC-6070: Added more options
This commit is contained in:
Pankaj Yadav
2024-07-12 23:14:51 +05:30
committed by GitHub
parent 14f05470be
commit ab5569b61b
4 changed files with 260 additions and 1 deletions

View File

@@ -1102,6 +1102,99 @@ exports[`VehicleUpdate Render 1`] = `
</span> </span>
</label> </label>
</div> </div>
<div>
<label
class="MuiFormControlLabel-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root"
>
<select
class="MuiSelect-root MuiSelect-select MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input"
id="send-command"
name="send-command"
>
<option
value="0"
>
Select How Long to Send DTCs
</option>
<option
value="43200"
>
12 Hours
</option>
<option
value="86400"
>
24 Hours
</option>
<option
value="172800"
>
48 Hours
</option>
<option
value="259200"
>
72 Hours
</option>
<option
value="604800"
>
1 Week
</option>
<option
value="1209600"
>
2 Weeks
</option>
<option
value="1814400"
>
3 Weeks
</option>
<option
value="2419200"
>
4 Weeks
</option>
<option
value="3024000"
>
5 Weeks
</option>
</select>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-0 MuiOutlinedInput-notchedOutline"
style="padding-left: 8px;"
>
<legend
class="PrivateNotchedOutline-legend-0"
style="width: 0.01px;"
>
<span>
</span>
</legend>
</fieldset>
</div>
<span
class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
/>
</label>
</div>
<div> <div>
<label <label
class="MuiFormControlLabel-root" class="MuiFormControlLabel-root"

View File

@@ -6,7 +6,8 @@ import {
FormLabel, FormLabel,
Radio, Radio,
RadioGroup, RadioGroup,
TextField TextField,
Select
} from "@material-ui/core"; } from "@material-ui/core";
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import { Redirect } from "react-router"; import { Redirect } from "react-router";
@@ -56,6 +57,20 @@ const MainForm = () => {
const [dltLevel, setDLTLevel] = useState(0); const [dltLevel, setDLTLevel] = useState(0);
const debugMaskEl = useRef(null); const debugMaskEl = useRef(null);
const tagsEl = useRef(null); const tagsEl = useRef(null);
const [dtc_ttl, setDtcTTL] = useState(0);
const dtcTtlList = [
{ value: 0, label: "Select How Long to Send DTCs" },
{ value: 43200, label: "12 Hours" },
{ value: 86400, label: "24 Hours" },
{ value: 172800, label: "48 Hours" },
{ value: 259200, label: "72 Hours" },
{ value: 604800, label: "1 Week" },
{ value: 1209600, label: "2 Weeks" },
{ value: 1814400, label: "3 Weeks" },
{ value: 2419200, label: "4 Weeks" },
{ value: 3024000, label: "5 Weeks" },
]
const showDebugMask = (process.env.REACT_APP_ENABLE_DEBUGMASK === "1"); const showDebugMask = (process.env.REACT_APP_ENABLE_DEBUGMASK === "1");
@@ -148,6 +163,10 @@ const MainForm = () => {
setDLTEnabled(event.target.checked); setDLTEnabled(event.target.checked);
} }
const changeDtcTTL = (event) => {
setDtcTTL(event.target.value);
}
const onDltLevelChange = (event) => { const onDltLevelChange = (event) => {
setDLTLevel(event.target.value); setDLTLevel(event.target.value);
} }
@@ -190,6 +209,7 @@ const MainForm = () => {
dlt_level: dltEnabled ? parseInt(dltLevel) : 0, dlt_level: dltEnabled ? parseInt(dltLevel) : 0,
debug_mask: debugMaskEl.current?.value, debug_mask: debugMaskEl.current?.value,
idps_enabled: idpsEnabled, idps_enabled: idpsEnabled,
dtc_ttl: +dtc_ttl
}; };
const result = await updateVehicle(vin, formData, token); const result = await updateVehicle(vin, formData, token);
@@ -467,6 +487,26 @@ const MainForm = () => {
/> />
} label="DTC Enabled" /> } label="DTC Enabled" />
</div> </div>
<div>
<FormControlLabel control={
<Select
native
value={dtc_ttl}
variant="outlined"
inputProps={{
name: "send-command",
id: "send-command",
}}
disabled={!dtcEnabled}
onChange={changeDtcTTL}
>
{dtcTtlList.map((item, index) => (
<option key={index} value={item.value}>
{item.label}
</option>
))}
</Select>} />
</div>
<div> <div>
<FormControlLabel control={ <FormControlLabel control={
<Checkbox <Checkbox

View File

@@ -603,6 +603,92 @@ exports[`FleetUpdate Render 1`] = `
DTC Enabled DTC Enabled
</span> </span>
</label> </label>
<div>
<div
class="MuiInputBase-root MuiOutlinedInput-root"
>
<select
class="MuiSelect-root MuiSelect-select MuiSelect-outlined MuiInputBase-input MuiOutlinedInput-input"
id="send-command"
name="send-command"
>
<option
value="0"
>
Select How Long to Send DTCs
</option>
<option
value="43200"
>
12 Hours
</option>
<option
value="86400"
>
24 Hours
</option>
<option
value="172800"
>
48 Hours
</option>
<option
value="259200"
>
72 Hours
</option>
<option
value="604800"
>
1 Week
</option>
<option
value="1209600"
>
2 Weeks
</option>
<option
value="1814400"
>
3 Weeks
</option>
<option
value="2419200"
>
4 Weeks
</option>
<option
value="3024000"
>
5 Weeks
</option>
</select>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSelect-icon MuiSelect-iconOutlined"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M7 10l5 5 5-5z"
/>
</svg>
<fieldset
aria-hidden="true"
class="PrivateNotchedOutline-root-0 MuiOutlinedInput-notchedOutline"
style="padding-left: 8px;"
>
<legend
class="PrivateNotchedOutline-legend-0"
style="width: 0.01px;"
>
<span>
</span>
</legend>
</fieldset>
</div>
</div>
<div <div
class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth" class="MuiFormControl-root MuiTextField-root MuiFormControl-marginNormal MuiFormControl-fullWidth"
> >

View File

@@ -10,6 +10,7 @@ import {
Radio, Radio,
RadioGroup, RadioGroup,
TextField, TextField,
Select,
} from "@material-ui/core"; } from "@material-ui/core";
import useStyles from "../../useStyles"; import useStyles from "../../useStyles";
@@ -42,6 +43,21 @@ const MainForm = () => {
const [dtcEnabled, setDTCEnabled] = useState(true); const [dtcEnabled, setDTCEnabled] = useState(true);
const debugMaskEl = useRef(null); const debugMaskEl = useRef(null);
const [dtc_ttl, setDtcTTL] = useState(0);
const dtcTtlList = [
{ value: 0, label: "Select How Long to Send DTCs" },
{ value: 43200, label: "12 Hours" },
{ value: 86400, label: "24 Hours" },
{ value: 172800, label: "48 Hours" },
{ value: 259200, label: "72 Hours" },
{ value: 604800, label: "1 Week" },
{ value: 1209600, label: "2 Weeks" },
{ value: 1814400, label: "3 Weeks" },
{ value: 2419200, label: "4 Weeks" },
{ value: 3024000, label: "5 Weeks" },
]
const showDebugMask = (process.env.REACT_APP_ENABLE_DEBUGMASK === "1"); const showDebugMask = (process.env.REACT_APP_ENABLE_DEBUGMASK === "1");
useEffect(() => { useEffect(() => {
@@ -111,6 +127,10 @@ const MainForm = () => {
setIDPSEnabled(event.target.checked); setIDPSEnabled(event.target.checked);
} }
const changeDtcTTL = (event) => {
setDtcTTL(event.target.value);
}
const onDataLoggerChange = (event) => { const onDataLoggerChange = (event) => {
setDataLoggerEnabled(event.target.checked); setDataLoggerEnabled(event.target.checked);
}; };
@@ -142,6 +162,7 @@ const MainForm = () => {
}, },
debug_mask: debugMaskEl.current?.value, debug_mask: debugMaskEl.current?.value,
idps_enabled: idpsEnabled, idps_enabled: idpsEnabled,
dtc_ttl: +dtc_ttl,
}; };
const result = await updateFleet(oldName, formData, token); const result = await updateFleet(oldName, formData, token);
@@ -257,6 +278,25 @@ const MainForm = () => {
onChange={onDtcEnabledChange} onChange={onDtcEnabledChange}
/> />
} label="DTC Enabled" /> } label="DTC Enabled" />
<div>
<Select
native
value={dtc_ttl}
variant="outlined"
inputProps={{
name: "send-command",
id: "send-command",
}}
disabled={!dtcEnabled}
onChange={changeDtcTTL}
>
{dtcTtlList.map((item, index) => (
<option key={index} value={item.value}>
{item.label}
</option>
))}
</Select>
</div>
{showDebugMask && ( {showDebugMask && (
<TextField <TextField
id="debug_mask" id="debug_mask"