fix: derive hosts threshold config list from config file keys

Previously all_threshold_configs was built from the threshold_checker
object, which may not be populated at render time, leaving the select
empty. Read directly from config["threshold_configs"] instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Andreas Wrede
2026-05-11 08:09:27 -04:00
parent 1dbe0f8e64
commit e1056a0365
+1 -6
View File
@@ -476,12 +476,7 @@ def get_settings_data(config: dict, threshold_checker=None) -> dict:
sections = get_settings_sections(config, threshold_checker=threshold_checker)
all_channel_names = sorted((config.get("notification_channels") or {}).keys())
all_usernames = sorted((config.get("users") or {}).keys())
# Threshold config names come from the parsed section data already in sections.
tc_section = next((s for s in sections if s["id"] == "thresholds"), None)
all_threshold_configs = (
[tc["name"] for tc in tc_section["threshold_configs"]]
if tc_section else []
)
all_threshold_configs = sorted((config.get("threshold_configs") or {}).keys())
return {
"sections": sections,
"all_channel_names": all_channel_names,