fix(settings): gateway-failover slider reflects the persisted value - #187
Merged
Merged
Conversation
…e saved value The gw-down-threshold slider is the only server-rendered settings value; the 'settings' template var was never injected into the page render, so the slider always showed the hardcoded default 90 regardless of the persisted value (and a subsequent slider touch would overwrite the real DB value with 90). Inject just that one key (not getAll(), to avoid exposing secrets) for the settings page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: gateway-failover-Slider zeigt gespeicherten Wert (statt immer 90)
Beim Live-Spot-Check des Settings-Autosave-Audits gefunden (pre-existing, eigene Klasse — Render-Kontext, nicht Dirty-Check).
Symptom: Slider auf z. B. 120 setzen → PUT feuert + „Saved" → nach Reload steht er wieder auf 90. Entkoppelt bestätigt:
api.put(120)→{ok:true}, Reload zeigt 90.Root-Cause: Der
gw-down-threshold-Slider ist das einzige server-gerenderte Settings-Feld (value="{{ settings.gateway_down_threshold_s or 90 }}"); alle anderen werden per JS-async-load*()befüllt. Aberres.locals.settingswird nirgends in den Seiten-Render injiziert → die Template-Variablesettingsist undefiniert → der Slider rendert immer denor 90-Default.Impact: Der Wert persistiert korrekt in die DB und wird von der Failover-Logik (
gatewayHealth/rdpMonitor) genutzt — die UI spiegelt ihn aber nie wider, und ein erneutes Anfassen würde den echten DB-Wert mit 90 überschreiben (Datenverlust-Risiko).Fix (Option A, minimal + sicher): Im Settings-Seiten-Route nur den einen benötigten Key injizieren —
extraLocals.settings = { gateway_down_threshold_s: settings.get('gateway_down_threshold_s') }(keingetAll()→ kein Secret-Exposure). Deckt alle 3 Themes ab (identisches Slider-Markup).Test:
tests/gateway_failover_render.test.js— PUT 150 → GET /settings → Slider rendertvalue="150"(vorher 90). Server-render via supertest, kein jsdom nötig.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jrun6RoK7g75W5L8ZEpBzh