From 65dc9b2bac334b4ac4dbfaaa27fe73595fe1e8bd Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sat, 14 Feb 2026 08:02:47 -0600 Subject: [PATCH] require restart when enabling camera that is disabled in config --- web/public/locales/en/views/settings.json | 2 +- .../views/settings/CameraManagementView.tsx | 44 +++++++++++++++---- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index 742025ce7..70aea99ea 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -430,7 +430,7 @@ "enableDesc": "Temporarily disable an enabled camera until Frigate restarts. Disabling a camera completely stops Frigate's processing of this camera's streams. Detection, recording, and debugging will be unavailable.
Note: This does not disable go2rtc restreams.", "disableLabel": "Disabled cameras", "disableDesc": "Enable a camera that is currently not visible in the UI and disabled in the configuration. A restart of Frigate is required after enabling.", - "enableSuccess": "Enabled {{cameraName}} in configuration" + "enableSuccess": "Enabled {{cameraName}} in configuration. Restart Frigate to apply the changes." }, "cameraConfig": { "add": "Add Camera", diff --git a/web/src/views/settings/CameraManagementView.tsx b/web/src/views/settings/CameraManagementView.tsx index 5781046f7..df250fab9 100644 --- a/web/src/views/settings/CameraManagementView.tsx +++ b/web/src/views/settings/CameraManagementView.tsx @@ -19,10 +19,12 @@ import { isDesktop } from "react-device-detect"; import { CameraNameLabel } from "@/components/camera/FriendlyNameLabel"; import { Switch } from "@/components/ui/switch"; import { Trans } from "react-i18next"; -import { useEnabledState } from "@/api/ws"; +import { useEnabledState, useRestart } from "@/api/ws"; import { Label } from "@/components/ui/label"; import axios from "axios"; import ActivityIndicator from "@/components/indicators/activity-indicator"; +import RestartDialog from "@/components/overlay/dialog/RestartDialog"; +import RestartRequiredIndicator from "@/components/indicators/RestartRequiredIndicator"; type CameraManagementViewProps = { setUnsavedChanges: React.Dispatch>; @@ -44,6 +46,10 @@ export default function CameraManagementView({ ); // Track camera being edited const [showWizard, setShowWizard] = useState(false); + // State for restart dialog when enabling a disabled camera + const [restartDialogOpen, setRestartDialogOpen] = useState(false); + const { send: sendRestart } = useRestart(); + // List of cameras for dropdown const enabledCameras = useMemo(() => { if (config) { @@ -148,6 +154,7 @@ export default function CameraManagementView({ htmlFor={"disabled-cameras-switch"} > {t("cameraManagement.streams.disableLabel")} +

{t("cameraManagement.streams.disableDesc")} @@ -166,6 +173,7 @@ export default function CameraManagementView({ ))} @@ -213,6 +221,11 @@ export default function CameraManagementView({ open={showWizard} onClose={() => setShowWizard(false)} /> + setRestartDialogOpen(false)} + onRestart={() => sendRestart("restart")} + /> ); } @@ -238,13 +251,22 @@ function CameraEnableSwitch({ cameraName }: CameraEnableSwitchProps) { ); } +type CameraConfigEnableSwitchProps = { + cameraName: string; + setRestartDialogOpen: React.Dispatch>; + onConfigChanged: () => Promise; +}; + function CameraConfigEnableSwitch({ cameraName, onConfigChanged, -}: CameraEnableSwitchProps & { - onConfigChanged: () => Promise; -}) { - const { t } = useTranslation(["common", "views/settings"]); + setRestartDialogOpen, +}: CameraConfigEnableSwitchProps) { + const { t } = useTranslation([ + "common", + "views/settings", + "components/dialog", + ]); const [isSaving, setIsSaving] = useState(false); const onCheckedChange = useCallback( @@ -257,7 +279,7 @@ function CameraConfigEnableSwitch({ try { await axios.put("config/set", { - requires_restart: 0, + requires_restart: 1, config_data: { cameras: { [cameraName]: { @@ -265,7 +287,6 @@ function CameraConfigEnableSwitch({ }, }, }, - update_topic: `config/cameras/${cameraName}/enabled`, }); await onConfigChanged(); @@ -277,6 +298,13 @@ function CameraConfigEnableSwitch({ }), { position: "top-center", + action: ( + setRestartDialogOpen(true)}> + + + ), }, ); } catch (error) { @@ -296,7 +324,7 @@ function CameraConfigEnableSwitch({ setIsSaving(false); } }, - [cameraName, isSaving, onConfigChanged, t], + [cameraName, isSaving, onConfigChanged, setRestartDialogOpen, t], ); return (