Merge branch 'develop' into feature/mobile-menu
This commit is contained in:
@@ -5,6 +5,8 @@ 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 { toast } from "sonner";
|
||||
|
||||
const SystemConfigFields = () => {
|
||||
const { saveSystemSettings, systemSettingsData, saveSystemSettingsLoading } = useSystemConfig();
|
||||
@@ -35,6 +37,14 @@ const SystemConfigFields = () => {
|
||||
if (!values.timeZone) errors.timeZone = "Required";
|
||||
if (isNaN(interval) || interval <= 0) errors.sntpInterval = "Cannot be less than 0";
|
||||
if (!values.sntpServer) errors.sntpServer = "Required";
|
||||
const invalidPrimary = ValidateIPaddress(values.serverPrimary);
|
||||
const invalidSecondary = ValidateIPaddress(values.serverSecondary);
|
||||
|
||||
if (invalidPrimary || invalidSecondary) {
|
||||
toast.error(invalidPrimary || invalidSecondary, {
|
||||
id: "invalid-ip",
|
||||
});
|
||||
}
|
||||
return errors;
|
||||
};
|
||||
|
||||
@@ -52,7 +62,7 @@ const SystemConfigFields = () => {
|
||||
onSubmit={handleSubmit}
|
||||
validate={validateValues}
|
||||
enableReinitialize
|
||||
validateOnChange
|
||||
validateOnChange={false}
|
||||
validateOnBlur
|
||||
>
|
||||
{({ values, errors, touched, isSubmitting }) => (
|
||||
|
||||
@@ -14,9 +14,6 @@ export async function sendBlobFileUpload({ file, opts }: BlobFileUpload): Promis
|
||||
if (!file) throw new Error("No file supplied");
|
||||
if (!opts?.uploadUrl) throw new Error("No URL supplied");
|
||||
|
||||
if (file?.type !== "text/csv") {
|
||||
throw new Error("This file is not supported, please upload a CSV file.");
|
||||
}
|
||||
const timeoutMs = opts?.timeoutMs ?? 30000;
|
||||
const fieldName = opts?.fieldName ?? "upload";
|
||||
const fileName = opts?.overrideFileName ?? file?.name;
|
||||
|
||||
Reference in New Issue
Block a user