diff --git a/src/pages/AdminSettings.tsx b/src/pages/AdminSettings.tsx index 0391ea7..2d9a46c 100644 --- a/src/pages/AdminSettings.tsx +++ b/src/pages/AdminSettings.tsx @@ -997,6 +997,19 @@ function MqttClientsTab() { if (res.ok) load() } + async function addTopic(c: MqttClient) { + const topic = prompt(`Add a topic scope to "${c.name}" (e.g. hvac/mhi/#) — existing scopes are kept:`) + if (!topic || !topic.trim()) return + const res = await fetch(`/settings/api/mqtt-clients/${c.id}`, { + method: 'PATCH', credentials: 'include', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ add_topic_scope: topic.trim() }), + }) + const data = await res.json() + if (!res.ok) { alert(data.error || 'Failed to add topic'); return } + load() + } + function copyPassword() { if (!created) return navigator.clipboard.writeText(created.password) @@ -1040,9 +1053,12 @@ function MqttClientsTab() { placeholder="e.g. Kitchen Flash Reader" style={inputStyle} />