- Disabled camera settings form

- updated Config payload to update RSTP
This commit is contained in:
2025-10-13 13:04:09 +01:00
parent 44962e7d81
commit eca3e9783e
2 changed files with 18 additions and 9 deletions

View File

@@ -104,7 +104,7 @@ const CameraSettingFields = ({
validateOnChange={false} validateOnChange={false}
enableReinitialize enableReinitialize
> >
{({ errors, touched, isSubmitting }) => ( {({ errors, touched }) => (
<Form className="flex flex-col space-y-6 p-2"> <Form className="flex flex-col space-y-6 p-2">
<div className="flex flex-col space-y-2 relative"> <div className="flex flex-col space-y-2 relative">
<label htmlFor="friendlyName">Name</label> <label htmlFor="friendlyName">Name</label>
@@ -119,6 +119,7 @@ const CameraSettingFields = ({
type="text" type="text"
className="p-2 border border-gray-400 rounded-lg" className="p-2 border border-gray-400 rounded-lg"
placeholder="Enter camera name" placeholder="Enter camera name"
disabled
/> />
</div> </div>
@@ -135,7 +136,7 @@ const CameraSettingFields = ({
type="text" type="text"
className="p-2 border border-gray-400 rounded-lg" className="p-2 border border-gray-400 rounded-lg"
placeholder="RTSP://..." placeholder="RTSP://..."
autoComplete="street-address" disabled
/> />
</div> </div>
@@ -153,6 +154,7 @@ const CameraSettingFields = ({
className="p-2 border border-gray-400 rounded-lg" className="p-2 border border-gray-400 rounded-lg"
placeholder="Enter user name" placeholder="Enter user name"
autoComplete="username" autoComplete="username"
disabled
/> />
</div> </div>
@@ -170,7 +172,7 @@ const CameraSettingFields = ({
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"
autoComplete="new-password" disabled
/> />
<FontAwesomeIcon <FontAwesomeIcon
type="button" type="button"
@@ -207,15 +209,20 @@ const CameraSettingFields = ({
</div> </div>
<div className="mt-3"> <div className="mt-3">
{updateCameraConfigError ? ( {updateCameraConfigError ? (
<button className="bg-red-500 text-white rounded-lg p-2 mx-auto h-[100%] w-full"> <button
className="bg-red-500 text-white rounded-lg p-2 mx-auto h-[100%] w-full"
disabled
>
Retry Retry
</button> </button>
) : ( ) : (
<button <button
type="submit" type="submit"
className="bg-[#26B170] text-white rounded-lg p-2 mx-auto h-[100%] w-full" className="bg-blue-700 text-white rounded-lg p-2 mx-auto h-[100%] w-full"
disabled
> >
{isSubmitting ? "Saving" : "Save settings"} {/* {isSubmitting ? "Saving" : "Save settings"} bg-[#26B170] */}
{"Disabled: Coming soon"}
</button> </button>
)} )}
</div> </div>

View File

@@ -17,6 +17,7 @@ const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => {
const updateCamerasideConfig = async (data: { const updateCamerasideConfig = async (data: {
id: string | number; id: string | number;
friendlyName: string; friendlyName: string;
cameraAddress: string;
}) => { }) => {
const updateUrl = `${base_url}/update-config?id=${data.id}`; const updateUrl = `${base_url}/update-config?id=${data.id}`;
@@ -24,16 +25,17 @@ const updateCamerasideConfig = async (data: {
id: data.friendlyName, id: data.friendlyName,
fields: [ fields: [
{ {
property: "id", property: "propURI",
value: data.friendlyName, value: data.cameraAddress,
}, },
], ],
}; };
console.log(updateConfigPayload);
const response = await fetch(updateUrl, { const response = await fetch(updateUrl, {
method: "POST", method: "POST",
body: JSON.stringify(updateConfigPayload), body: JSON.stringify(updateConfigPayload),
}); });
if (!response.ok) throw new Error("Cannot reach update camera endpoint"); if (!response.ok) throw new Error("Feature unavailable: Coming soon");
}; };
export const useFetchCameraConfig = (cameraSide: string) => { export const useFetchCameraConfig = (cameraSide: string) => {