feat: replace YAML hosts editor with form-based CRUD table
Settings > Hosts now renders a table with per-column controls (watch, dyndns, owner, managers/monitors multi-select, threshold config, notification channels) instead of a raw YAML textarea. Changes stage via the existing Publish flow like other form sections. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-2
@@ -436,7 +436,7 @@ def get_settings_sections(config: dict, threshold_checker=None) -> list:
|
||||
"id": "hosts",
|
||||
"title": "Hosts",
|
||||
"description": "Host definitions loaded from the config file.",
|
||||
"section_mode": "yaml",
|
||||
"section_mode": "hosts",
|
||||
"api_section": "hosts",
|
||||
"hosts": hosts_list,
|
||||
"fields": [],
|
||||
@@ -475,4 +475,16 @@ def get_settings_data(config: dict, threshold_checker=None) -> dict:
|
||||
"""Return sections list + auxiliary data for the settings template."""
|
||||
sections = get_settings_sections(config, threshold_checker=threshold_checker)
|
||||
all_channel_names = sorted((config.get("notification_channels") or {}).keys())
|
||||
return {"sections": sections, "all_channel_names": all_channel_names}
|
||||
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 []
|
||||
)
|
||||
return {
|
||||
"sections": sections,
|
||||
"all_channel_names": all_channel_names,
|
||||
"all_usernames": all_usernames,
|
||||
"all_threshold_configs": all_threshold_configs,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user