- implement user settings reset functionality with modal confirmation

and bug fixes regarding lane IDs to sighting endpoints
This commit is contained in:
2026-01-07 09:39:46 +00:00
parent f046ae6dfc
commit f9188bb46f
13 changed files with 186 additions and 140 deletions

View File

@@ -8,6 +8,7 @@ import { useDNSSettings, useSystemConfig } from "../../../hooks/useSystemConfig"
import { ValidateIPaddress, isUtcOutOfSync } from "../../../utils/utils";
import { toast } from "sonner";
import { useSystemStatus } from "../../../hooks/useSystemStatus";
// import ResetUserSettings from "./resetUserSettings/ResetUserSettings";
const SystemConfigFields = () => {
const { saveSystemSettings, systemSettingsData, saveSystemSettingsLoading } = useSystemConfig();
@@ -27,6 +28,7 @@ const SystemConfigFields = () => {
localdate: localDate,
localtime: localTime,
});
const syncTime = new Date(systemStatusQuery?.data?.SystemStatus?.synctime * 1000).toLocaleString();
const sntpInterval = systemSettingsData?.sntpInterval;
const dnsPrimary = dnsQuery?.data?.propNameServerPrimary?.value;
@@ -84,13 +86,6 @@ const SystemConfigFields = () => {
>
{({ values, errors, touched, isSubmitting }) => (
<Form className="flex flex-col space-y-5 px-2">
<div>
{utcOutOfSync?.outOfSync ? (
<span className="text-red-800 bg-red-300 border border-red-800 rounded-lg p-2">UTC is out of sync</span>
) : (
<span className="text-green-300 bg-green-800 border border-green-600 rounded-lg p-2">UTC is in sync</span>
)}
</div>
<FormGroup>
<label htmlFor="deviceName" className="font-medium whitespace-nowrap md:w-1/2 text-left">
Device Name
@@ -189,6 +184,14 @@ const SystemConfigFields = () => {
autoComplete="off"
/>
</FormGroup>
<div className="flex flex-col gap-2 w-70">
{utcOutOfSync?.outOfSync ? (
<span className="text-red-800 bg-red-300 border border-red-800 rounded-lg p-2 ">UTC is out of sync</span>
) : (
<span className="text-green-300 bg-green-800 border border-green-600 rounded-lg p-2">UTC is in sync</span>
)}
<p className="mt-2">Last Sync Time: {syncTime}</p>
</div>
<button
type="submit"
className="w-full md:w-1/4 text-white bg-green-700 hover:bg-green-800 font-small rounded-lg text-sm px-2 py-2.5"
@@ -215,6 +218,7 @@ const SystemConfigFields = () => {
>
{hardRebootMutation.isPending || isSubmitting ? "Rebooting" : "Hardware Reboot"}
</button>
{/* <ResetUserSettings /> */}
</Form>
)}
</Formik>