feat(alerts): a covering rule's hosts fold away behind its "N hosts" (#5483)
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 1m7s
CI / unit (push) Successful in 1m26s
CI / publish (push) Successful in 1m9s

#5483 "Alerts list: a covering rule's hosts start collapsed behind a toggle;
no dashed rows", from the operator's review of the Alerts list. Each rule is
its own tbody; its hosts sit in another, hidden until "N hosts" is pressed.
A rule with a host that isn't quiet opens on its own and names the host where
"last fired" was, so a problem never hides behind the fold. Host rows lose the
dashed rules for a sunken band under the indent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 10:40:17 -04:00
co-authored by Claude Opus 5.5
parent 731e7cd6e6
commit a642b4c37c
4 changed files with 55 additions and 11 deletions
+10
View File
@@ -292,7 +292,11 @@ async def test_a_rule_covering_hosts_lists_its_hosts_under_it(app):
session["user_role"] = "operator"
listing = await render_template(
"alerts/list.html", active=[], rules=[parent], children={"p1": kids},
uneasy={"p1": ["node-a"]},
rule_state={"p1": "firing", "k0": "firing", "k1": "inactive"}, operators=[])
quiet = await render_template(
"alerts/list.html", active=[], rules=[parent], children={"p1": kids},
uneasy={"p1": []}, rule_state={"p1": "inactive"}, operators=[])
page = await render_template(
"alerts/rules_form.html", rule=parent, operators=[], source_modules=["host_agent"],
initial_source="host_agent", resources=[], metrics=["seconds_since_seen"],
@@ -305,6 +309,12 @@ async def test_a_rule_covering_hosts_lists_its_hosts_under_it(app):
assert listing.index("Agent offline</a>") < listing.index('href="/alerts/history?rule=k0"') \
< listing.index('href="/alerts/history?rule=k1"')
assert 'class="row-link row-child"' in listing
# #5483: the hosts sit behind the rule's toggle, open while one isn't quiet.
assert 'aria-expanded="true" aria-controls="hosts-p1"' in listing and "on node-a" in listing
assert '<tbody id="hosts-p1" class="row-children">' in listing
quiet = " ".join(quiet.split())
assert 'aria-expanded="false" aria-controls="hosts-p1"' in quiet
assert '<tbody id="hosts-p1" class="row-children" hidden>' in quiet and "never fired" in quiet
assert "Covers every host in <strong>swarm</strong>: 2 now (node-a, node-b)" in page
assert 'name="covers" value="group"' in page and "fixed once the rule exists" in page
assert 'data-cover-resource hidden' in page