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:
@@ -476,12 +476,7 @@ def get_settings_data(config: dict, threshold_checker=None) -> dict:
|
|||||||
sections = get_settings_sections(config, threshold_checker=threshold_checker)
|
sections = get_settings_sections(config, threshold_checker=threshold_checker)
|
||||||
all_channel_names = sorted((config.get("notification_channels") or {}).keys())
|
all_channel_names = sorted((config.get("notification_channels") or {}).keys())
|
||||||
all_usernames = sorted((config.get("users") or {}).keys())
|
all_usernames = sorted((config.get("users") or {}).keys())
|
||||||
# Threshold config names come from the parsed section data already in sections.
|
all_threshold_configs = sorted((config.get("threshold_configs") or {}).keys())
|
||||||
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 []
|
|
||||||
)
|
|
||||||
return {
|
return {
|
||||||
"sections": sections,
|
"sections": sections,
|
||||||
"all_channel_names": all_channel_names,
|
"all_channel_names": all_channel_names,
|
||||||
|
|||||||
Reference in New Issue
Block a user