7 Commits

Author SHA1 Message Date
c057ce5084 Merge pull request 'develop' (#2) from develop into main
Reviewed-on: #2
2025-11-11 12:52:29 +00:00
0c7d99f7ea minor bugfix: removed csv check for update files 2025-11-11 12:50:48 +00:00
f2e10f958d Merge pull request 'added wifi validation' (#1) from bugfix/wifi into develop
Reviewed-on: #1
2025-11-11 12:40:15 +00:00
903b856303 added wifi validation 2025-11-11 12:37:28 +00:00
672ff1d2f1 Merged main into develop 2025-11-11 10:49:06 +00:00
08a07b7ffb Merged in develop (pull request #38)
Develop
2025-11-11 10:46:53 +00:00
d60c546db1 Merged in bugfix/Matttesting (pull request #37)
Bugfix/Matttesting
2025-11-11 10:45:25 +00:00
2 changed files with 70 additions and 60 deletions

View File

@@ -14,9 +14,6 @@ export async function sendBlobFileUpload({ file, opts }: BlobFileUpload): Promis
if (!file) throw new Error("No file supplied"); if (!file) throw new Error("No file supplied");
if (!opts?.uploadUrl) throw new Error("No URL 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 timeoutMs = opts?.timeoutMs ?? 30000;
const fieldName = opts?.fieldName ?? "upload"; const fieldName = opts?.fieldName ?? "upload";
const fileName = opts?.overrideFileName ?? file?.name; const fileName = opts?.overrideFileName ?? file?.name;

View File

@@ -5,6 +5,7 @@ import { useWifiAndModem } from "../../../hooks/useCameraWifiandModem";
import { useState } from "react"; import { useState } from "react";
import { faEyeSlash, faEye } from "@fortawesome/free-solid-svg-icons"; import { faEyeSlash, faEye } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { toast, Toaster } from "sonner";
const WiFiSettingsForm = () => { const WiFiSettingsForm = () => {
const [showPwd, setShowPwd] = useState(false); const [showPwd, setShowPwd] = useState(false);
@@ -19,6 +20,13 @@ const WiFiSettingsForm = () => {
encryption: "WPA2", encryption: "WPA2",
}; };
const validatePassword = (password: string) => {
if (password.length < 8) {
toast.error("Password must be at least 8 characters long", { id: "password" });
return "Password must be at least 8 characters long";
}
};
const handleSubmit = async (values: WifiSettingValues) => { const handleSubmit = async (values: WifiSettingValues) => {
const wifiConfig = { const wifiConfig = {
id: "ModemAndWifiManager-wifi", id: "ModemAndWifiManager-wifi",
@@ -37,6 +45,7 @@ const WiFiSettingsForm = () => {
await wifiMutation.mutateAsync(wifiConfig); await wifiMutation.mutateAsync(wifiConfig);
}; };
return ( return (
<>
<Formik initialValues={initialValues} onSubmit={handleSubmit} enableReinitialize> <Formik initialValues={initialValues} onSubmit={handleSubmit} enableReinitialize>
{({ isSubmitting }) => ( {({ isSubmitting }) => (
<Form className="flex flex-col space-y-5 px-2"> <Form className="flex flex-col space-y-5 px-2">
@@ -63,7 +72,9 @@ const WiFiSettingsForm = () => {
type={showPwd ? "text" : "password"} type={showPwd ? "text" : "password"}
className="p-2 border border-gray-400 rounded-lg w-full" className="p-2 border border-gray-400 rounded-lg w-full"
placeholder="Enter Password" placeholder="Enter Password"
validate={validatePassword}
/> />
<FontAwesomeIcon <FontAwesomeIcon
type="button" type="button"
className="absolute right-5 end-0" className="absolute right-5 end-0"
@@ -97,6 +108,8 @@ const WiFiSettingsForm = () => {
</Form> </Form>
)} )}
</Formik> </Formik>
<Toaster />
</>
); );
}; };