- updated version to 1.0.23, enhance audio file handling, and improve UTC synchronization checks
This commit is contained in:
@@ -5,16 +5,29 @@ import { timezones } from "./timezones";
|
||||
import SystemFileUpload from "./SystemFileUpload";
|
||||
import type { SystemValues, SystemValuesErrors } from "../../../types/types";
|
||||
import { useDNSSettings, useSystemConfig } from "../../../hooks/useSystemConfig";
|
||||
import { ValidateIPaddress } from "../../../utils/utils";
|
||||
import { ValidateIPaddress, isUtcOutOfSync } from "../../../utils/utils";
|
||||
import { toast } from "sonner";
|
||||
// import { useSystemStatus } from "../../../hooks/useSystemStatus";
|
||||
import { useSystemStatus } from "../../../hooks/useSystemStatus";
|
||||
|
||||
const SystemConfigFields = () => {
|
||||
const { saveSystemSettings, systemSettingsData, saveSystemSettingsLoading } = useSystemConfig();
|
||||
// const { systemStatusQuery } = useSystemStatus();
|
||||
const { systemStatusQuery } = useSystemStatus();
|
||||
const { hardRebootMutation } = useReboots();
|
||||
const { dnsQuery, dnsMutation } = useDNSSettings();
|
||||
|
||||
if (systemStatusQuery?.isLoading || !systemStatusQuery?.data) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
const utcTime = systemStatusQuery?.data?.SystemStatus?.utctime;
|
||||
const localDate = systemStatusQuery?.data?.SystemStatus?.localdate;
|
||||
const localTime = systemStatusQuery?.data?.SystemStatus?.localtime;
|
||||
|
||||
const utcOutOfSync = isUtcOutOfSync({
|
||||
utctime: utcTime,
|
||||
localdate: localDate,
|
||||
localtime: localTime,
|
||||
});
|
||||
|
||||
const sntpInterval = systemSettingsData?.sntpInterval;
|
||||
const dnsPrimary = dnsQuery?.data?.propNameServerPrimary?.value;
|
||||
const dnsSecondary = dnsQuery?.data?.propNameServerSecondary?.value;
|
||||
@@ -71,6 +84,13 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user