feat(ui): audit, alert rules and the rule form say things in words (#5212)
#5212 "Plain labels: no raw ids, scopes, metric keys or unexplained jargon", batch 1: - Audit log: each action reads as a sentence ("paused monitor"), with the code as its tooltip. Detail shows flags as yes/no, lists joined, a run's scope by name, spans as spans, and no ids the entity column already gives. The filter is now a picker of areas. - Alert rules, history and Status say the condition in words: "is down", "Fullest disk >= 85%". Readings use metric_value, and history times use |ago. - Rule form: sources and metrics by name, the threshold's unit, "fires when it is down/up" for an up/down metric instead of 0.5, and a metric reference built from the catalog. - Schedules and Maintenance: viewers no longer see Run now, Pause, Edit, Delete or New. Intervals and next runs read as "every 2h" and "in 3h"; a scope reads "Every alert on Host agent". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,11 @@ def create_app(
|
||||
# The status and layout macros in _macros.html read these.
|
||||
app.jinja_env.globals["status_info"] = _fmt.status_info
|
||||
app.jinja_env.globals["required"] = _fmt.required
|
||||
# A metric and its source in words, a reading in its unit (alerts pages).
|
||||
for _name in ("metric_label", "metric_about", "metric_unit", "metric_value", "source_label"):
|
||||
app.jinja_env.globals[_name] = getattr(_fmt, _name)
|
||||
from .alerts.service import rule_condition as _rule_condition
|
||||
app.jinja_env.globals["rule_condition"] = _rule_condition
|
||||
from .models.monitors import MONITOR_TYPE_LABELS as _type_labels
|
||||
app.jinja_env.filters["monitor_type"] = lambda t: _type_labels.get(t, str(t).upper())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user