diff --git a/hbd/server/settings.py b/hbd/server/settings.py
index 68eb7c5..5200ef8 100644
--- a/hbd/server/settings.py
+++ b/hbd/server/settings.py
@@ -284,7 +284,10 @@ def get_settings_sections(config: dict, threshold_checker=None) -> list:
"owner": hcfg.get("owner", ""),
"managers": hcfg.get("managers", []),
"monitors": hcfg.get("monitors", []),
- "threshold_config": hcfg.get("threshold_config", ""),
+ "threshold_configs": (
+ list(v) if isinstance(v := hcfg.get("threshold_config"), list)
+ else ([v] if v else [])
+ ),
"notification_channels": hcfg.get("notification_channels", []),
})
diff --git a/hbd/server/templates/settings.html b/hbd/server/templates/settings.html
index 806f65d..2a55dc5 100644
--- a/hbd/server/templates/settings.html
+++ b/hbd/server/templates/settings.html
@@ -591,10 +591,9 @@
- |
@@ -981,8 +980,8 @@
if (managers.length) entry.managers = managers;
const monitors = [...(row.querySelector('.host-monitors')?.selectedOptions || [])].map(o => o.value);
if (monitors.length) entry.monitors = monitors;
- const tc = row.querySelector('.host-tc').value;
- if (tc) entry.threshold_config = tc;
+ const tcs = [...(row.querySelector('.host-tc')?.selectedOptions || [])].map(o => o.value);
+ if (tcs.length) entry.threshold_config = tcs;
const chs = [...(row.querySelector('.host-channels')?.selectedOptions || [])].map(o => o.value);
if (chs.length) entry.notification_channels = chs;
return entry;
@@ -1007,9 +1006,7 @@
const tbody = document.getElementById('hosts-tbody');
const sz = n => Math.min(Math.max(n, 1), 4);
const usersOpts = _allUsers.map(u => ``).join('');
- const tcOpts = [''].concat(
- _allThresholdConfigs.map(t => ``)
- ).join('');
+ const tcOpts = _allThresholdConfigs.map(t => ``).join('');
const chOpts = _allChannels.map(c => ``).join('');
const row = document.createElement('tr');
row.setAttribute('data-new-host', 'true');
@@ -1020,7 +1017,7 @@
|
${usersOpts} |
${usersOpts} |
- ${tcOpts} |
+ ${tcOpts} |
${chOpts} |
| `;
tbody.appendChild(row);