fix(alerts): a rule's page doesn't wait for its metric preview (#5485); Send test up top (#5486)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 1m10s
CI / unit (push) Successful in 1m26s
CI / publish (push) Successful in 1m5s

#5485 "A rule's page waits up to 25 s for its metric preview: a cold 24 h
series read from plugin_metrics". Opening "Agent offline" took 25.6 s; a
cold day of one series measured 18.3 s over MCP, a warm one 63 ms. The
pickers still come with the page from plugin_metric_latest; the preview is
its own request (hx-trigger=load), showing "Reading the last day…" until it
lands. Picker swaps no longer read it either.

#5486 "Send test where it can be found": the button moves from inside "What
happens" to the page header beside History, its result under the verdict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 11:44:19 -04:00
co-authored by Claude Opus 5.5
parent a642b4c37c
commit 73cfbda1da
7 changed files with 40 additions and 23 deletions
+8 -2
View File
@@ -3,7 +3,8 @@
so on), so a host's parts never crowd the list of hosts. Any other source:
one Resource picker. Then the metrics that resource reports, and a preview
of the chosen one. Picking a host or part swaps this block alone
(/alerts/api/rule_target); picking a metric swaps the preview. #}
(/alerts/api/rule_target); picking a metric swaps the preview, which
is read in its own request after the block is drawn (#5485). #}
{% set one = current_covers|default("resource") == "resource" %}
<div data-cover-resource {% if not one %}hidden{% endif %}>
{% if host_source %}
@@ -68,5 +69,10 @@
{% if metric and metric_about(metric) %}
<p class="field-hint" data-metric-about>{{ metric_about(metric) }}</p>
{% else %}<p class="field-hint" data-metric-about hidden></p>{% endif %}
<div id="metric-preview" aria-live="polite">{% include "alerts/_metric_preview.html" %}</div>
{# The preview comes in its own request once the page is up (#5485). #}
<div id="metric-preview" aria-live="polite"
{%- if metric and resource %} hx-get="/alerts/api/metric_preview" hx-trigger="load"
hx-include="closest form" hx-params="source_module,resource_name,pick_host,metric_name,covers"{% endif %}>
{%- include "alerts/_metric_preview.html" -%}
</div>
</div>