From 260237bf1a5e7c2be1cc6c51a67b69813c7dcc9b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 25 Jan 2026 09:05:58 -0600 Subject: [PATCH] ensure update_topic is added to api calls this needs further backend implementation to work correctly --- .../config-form/sections/BaseSection.tsx | 23 ++++++++++++++++++- web/src/views/settings/GlobalConfigView.tsx | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/web/src/components/config-form/sections/BaseSection.tsx b/web/src/components/config-form/sections/BaseSection.tsx index ff688d4c3..2a07c2857 100644 --- a/web/src/components/config-form/sections/BaseSection.tsx +++ b/web/src/components/config-form/sections/BaseSection.tsx @@ -89,6 +89,17 @@ export function createConfigSection({ i18nNamespace, defaultConfig, }: CreateSectionOptions) { + const cameraUpdateTopicMap: Record = { + detect: "detect", + record: "record", + snapshots: "snapshots", + motion: "motion", + objects: "objects", + review: "review", + audio: "audio", + notifications: "notifications", + }; + const ConfigSection = function ConfigSection({ level, cameraName, @@ -110,6 +121,13 @@ export function createConfigSection({ > | null>(null); const [isSaving, setIsSaving] = useState(false); + const updateTopic = + level === "camera" && cameraName + ? cameraUpdateTopicMap[sectionPath] + ? `config/cameras/${cameraName}/${cameraUpdateTopicMap[sectionPath]}` + : undefined + : `config/${sectionPath}`; + // Default: show title for camera level (since it might be collapsible), hide for global const shouldShowTitle = showTitle ?? level === "camera"; @@ -280,6 +298,7 @@ export function createConfigSection({ await axios.put("config/set", { requires_restart: requiresRestart ? 0 : 1, + update_topic: updateTopic, config_data: { [basePath]: overrides, }, @@ -345,6 +364,7 @@ export function createConfigSection({ sanitizeSectionData, buildOverrides, schemaDefaults, + updateTopic, ]); // Handle reset to global - removes camera-level override by deleting the section @@ -357,6 +377,7 @@ export function createConfigSection({ // Send empty string to delete the key from config (see update_yaml in backend) await axios.put("config/set", { requires_restart: requiresRestart ? 0 : 1, + update_topic: updateTopic, config_data: { [basePath]: "", }, @@ -379,7 +400,7 @@ export function createConfigSection({ }), ); } - }, [level, cameraName, requiresRestart, t, refreshConfig]); + }, [level, cameraName, requiresRestart, t, refreshConfig, updateTopic]); if (!sectionSchema) { return null; diff --git a/web/src/views/settings/GlobalConfigView.tsx b/web/src/views/settings/GlobalConfigView.tsx index 1b61db40e..7d68684b6 100644 --- a/web/src/views/settings/GlobalConfigView.tsx +++ b/web/src/views/settings/GlobalConfigView.tsx @@ -215,6 +215,7 @@ const GlobalConfigSection = memo(function GlobalConfigSection({ setIsSaving(true); try { await axios.put("config/set", { + update_topic: `config/${sectionKey}`, config_data: { [sectionKey]: pendingData, },