feat: add per-metric grace period input to thresholds settings page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -742,6 +742,7 @@
|
||||
<th>Metric path</th><th>Op</th>
|
||||
<th>Warning</th><th>Critical</th>
|
||||
<th>Hysteresis</th><th>Count</th>
|
||||
<th title="Grace period (s) — overrides global; empty = use global">Grace</th>
|
||||
<th style="max-width:160px">Display</th>
|
||||
<th>En</th><th></th>
|
||||
</tr></thead>
|
||||
@@ -766,6 +767,9 @@
|
||||
value="{{ m.hysteresis if m.hysteresis is not none else 0.02 }}"></td>
|
||||
<td><input type="number" class="field-input thresh-count" step="1" min="1" style="width:52px"
|
||||
value="{{ m.count if m.count is not none else 1 }}"></td>
|
||||
<td><input type="number" class="field-input thresh-grace" step="any" min="0" style="width:60px"
|
||||
value="{{ m.grace if m.grace is not none else '' }}"
|
||||
placeholder="(global)"></td>
|
||||
<td><input type="text" class="field-input thresh-display" style="width:150px"
|
||||
value="{{ m.display | e }}" placeholder="(default)"></td>
|
||||
<td style="text-align:center"><input type="checkbox" class="thresh-enabled"
|
||||
@@ -1467,6 +1471,7 @@
|
||||
const crit = row.querySelector('.thresh-crit')?.value;
|
||||
const hyst = row.querySelector('.thresh-hyst')?.value;
|
||||
const count = row.querySelector('.thresh-count')?.value;
|
||||
const grace = row.querySelector('.thresh-grace')?.value;
|
||||
const display = row.querySelector('.thresh-display')?.value || '';
|
||||
const enabled = row.querySelector('.thresh-enabled')?.checked ?? true;
|
||||
const entry = { operator: op, enabled: enabled };
|
||||
@@ -1474,6 +1479,7 @@
|
||||
if (crit !== '' && crit !== undefined) entry.critical = parseFloat(crit);
|
||||
if (hyst !== '' && hyst !== undefined) entry.hysteresis = parseFloat(hyst);
|
||||
if (count !== '' && count !== undefined) entry.count = parseInt(count, 10);
|
||||
if (grace !== '' && grace !== undefined) entry.grace = parseFloat(grace);
|
||||
if (display) entry.display = display;
|
||||
metrics[metric] = entry;
|
||||
});
|
||||
@@ -1525,6 +1531,7 @@
|
||||
<td><input type="number" class="field-input thresh-crit" step="any" style="width:80px"></td>
|
||||
<td><input type="number" class="field-input thresh-hyst" step="any" style="width:72px" value="0.02"></td>
|
||||
<td><input type="number" class="field-input thresh-count" step="1" min="1" style="width:52px" value="1"></td>
|
||||
<td><input type="number" class="field-input thresh-grace" step="any" min="0" style="width:60px" placeholder="(global)"></td>
|
||||
<td><input type="text" class="field-input thresh-display" style="width:150px" placeholder="(default)"></td>
|
||||
<td style="text-align:center"><input type="checkbox" class="thresh-enabled" checked></td>
|
||||
<td><button class="btn-danger" onclick="this.closest('tr').remove()">✕</button></td>`;
|
||||
|
||||
Reference in New Issue
Block a user