- 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}
enableReinitialize
>
{({ errors, touched, isSubmitting }) => (
{({ errors, touched }) => (
<Form className="flex flex-col space-y-6 p-2">
<div className="flex flex-col space-y-2 relative">
<label htmlFor="friendlyName">Name</label>
@@ -119,6 +119,7 @@ const CameraSettingFields = ({
type="text"
className="p-2 border border-gray-400 rounded-lg"
placeholder="Enter camera name"
disabled
/>
</div>
@@ -135,7 +136,7 @@ const CameraSettingFields = ({
type="text"
className="p-2 border border-gray-400 rounded-lg"
placeholder="RTSP://..."
autoComplete="street-address"
disabled
/>
</div>
@@ -153,6 +154,7 @@ const CameraSettingFields = ({
className="p-2 border border-gray-400 rounded-lg"
placeholder="Enter user name"
autoComplete="username"
disabled
/>
</div>
@@ -170,7 +172,7 @@ const CameraSettingFields = ({
type={showPwd ? "text" : "password"}
className="p-2 border border-gray-400 rounded-lg w-full "
placeholder="Enter password"
autoComplete="new-password"
disabled
/>
<FontAwesomeIcon
type="button"
@@ -207,15 +209,20 @@ const CameraSettingFields = ({
</div>
<div className="mt-3">
{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
</button>
) : (
<button
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>
)}
</div>

View File

@@ -17,6 +17,7 @@ const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => {
const updateCamerasideConfig = async (data: {
id: string | number;
friendlyName: string;
cameraAddress: string;
}) => {
const updateUrl = `${base_url}/update-config?id=${data.id}`;
@@ -24,16 +25,17 @@ const updateCamerasideConfig = async (data: {
id: data.friendlyName,
fields: [
{
property: "id",
value: data.friendlyName,
property: "propURI",
value: data.cameraAddress,
},
],
};
console.log(updateConfigPayload);
const response = await fetch(updateUrl, {
method: "POST",
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) => {