From ab5569b61b2413be35b77839a814df5ffcaced87 Mon Sep 17 00:00:00 2001 From: Pankaj Yadav Date: Fri, 12 Jul 2024 23:14:51 +0530 Subject: [PATCH] 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 --- .../Update/__snapshots__/index.test.jsx.snap | 93 +++++++++++++++++++ src/components/Cars/Update/index.jsx | 42 ++++++++- .../Update/__snapshots__/index.test.jsx.snap | 86 +++++++++++++++++ src/components/Fleets/Update/index.jsx | 40 ++++++++ 4 files changed, 260 insertions(+), 1 deletion(-) diff --git a/src/components/Cars/Update/__snapshots__/index.test.jsx.snap b/src/components/Cars/Update/__snapshots__/index.test.jsx.snap index 4dbabb9..0015df1 100644 --- a/src/components/Cars/Update/__snapshots__/index.test.jsx.snap +++ b/src/components/Cars/Update/__snapshots__/index.test.jsx.snap @@ -1102,6 +1102,99 @@ exports[`VehicleUpdate Render 1`] = ` +
+ +
+
+ + {dtcTtlList.map((item, index) => ( + + ))} + } /> +
+
+
+ + + +
+
diff --git a/src/components/Fleets/Update/index.jsx b/src/components/Fleets/Update/index.jsx index 66eb3dd..4cc6b0d 100644 --- a/src/components/Fleets/Update/index.jsx +++ b/src/components/Fleets/Update/index.jsx @@ -10,6 +10,7 @@ import { Radio, RadioGroup, TextField, + Select, } from "@material-ui/core"; import useStyles from "../../useStyles"; @@ -42,6 +43,21 @@ const MainForm = () => { const [dtcEnabled, setDTCEnabled] = useState(true); 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"); useEffect(() => { @@ -111,6 +127,10 @@ const MainForm = () => { setIDPSEnabled(event.target.checked); } + const changeDtcTTL = (event) => { + setDtcTTL(event.target.value); + } + const onDataLoggerChange = (event) => { setDataLoggerEnabled(event.target.checked); }; @@ -142,6 +162,7 @@ const MainForm = () => { }, debug_mask: debugMaskEl.current?.value, idps_enabled: idpsEnabled, + dtc_ttl: +dtc_ttl, }; const result = await updateFleet(oldName, formData, token); @@ -257,6 +278,25 @@ const MainForm = () => { onChange={onDtcEnabledChange} /> } label="DTC Enabled" /> +
+ +
{showDebugMask && (