Skip to content

[RnA: Alerting-V2] Rule list: improve Tags truncation #260951

Merged
yiannisnikolopoulos merged 5 commits intoelastic:mainfrom
ana-davydova:alertingv2-tags-fix
Apr 3, 2026
Merged

[RnA: Alerting-V2] Rule list: improve Tags truncation #260951
yiannisnikolopoulos merged 5 commits intoelastic:mainfrom
ana-davydova:alertingv2-tags-fix

Conversation

@ana-davydova
Copy link
Copy Markdown
Contributor

Closes #257

Improves tag display in the alerting v2 rules list table and adds tag length validation to the rule creation form.

Changes

Rules list: tag truncation

  • Limit visible tags to 1 per row; remaining tags are collapsed behind a +N badge with a tag icon
  • Hovering over the +N badge shows all overflow tags in a tooltip
  • Long tag text is truncated with ... via CSS (text-overflow: ellipsis), with a tooltip showing the full text on hover
  • Tags stay on a single line and never overflow into adjacent columns
  • Labels column width increased from 12% to 20%; Mode and Status columns adjusted accordingly
  • All badges inside tooltips have tabIndex={0} for keyboard accessibility

Rule form: tag length validation

  • Added client-side validation on the Tags field: each tag must be no longer than 64 characters (matching the server-side Zod schema constraint z.string().max(64))
  • Follows the same rules.validate pattern used by the Name field
  • Error is shown inline on the field and in the ErrorCallOut when the user submits the form
image image

Test plan

  • Create a rule with many tags (>1) — only the first tag should be visible, with a +N badge for the rest
  • Hover over the +N badge — tooltip should show all remaining tags
  • Create a rule with a long tag name — tag should truncate with ... in the list, tooltip shows full text
  • Tab to tag badges with keyboard — tooltip should appear on focus
  • Create a rule with a tag longer than 64 characters and submit — validation error should appear
  • Create a rule with a tag of exactly 64 characters — should succeed

…e width of other columns too, added check for max_visible_labels
…wed it to the user, so the tags_field.tsx was updated with the changes to show the validation error if the tag's character length is more than 64 characters
@ana-davydova ana-davydova requested a review from a team as a code owner April 2, 2026 14:53
@github-actions github-actions bot added the author:actionable-obs PRs authored by the actionable obs team label Apr 2, 2026
@ana-davydova ana-davydova added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting author:actionable-obs PRs authored by the actionable obs team and removed author:actionable-obs PRs authored by the actionable obs team labels Apr 2, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 2, 2026

Approvability

Verdict: Needs human review

The PR adds tag length validation (max 64 chars) and improves tag display truncation in the rules list. While the changes are straightforward, the author does not own any of the modified files—all are owned by @elastic/rna-project-team—so designated owners should review.

You can customize Macroscope's approvability policy. Learn more.

Copy link
Copy Markdown
Contributor

@yiannisnikolopoulos yiannisnikolopoulos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QQ: Why did we choose to follow this approach for truncation? It seems that the EuiBadge already supports truncation and default browser tooltips. Quoting from EUI docs: To ensure proper wrapping, truncation and spacing of multiple badges, it is advisable to wrap them in a EuiBadgeGroup.

Also a few nits:

  • Even a short tag like "prod" gets a tooltip repeating the same text. Consider only showing the tooltip when the text is actually truncated(if we decide to keep the current approach)
  • Consider exporting the constant MAX_TAG_LENGTH from @kbn/alerting-v2-schemas and importing it in both client and server side.
  • data-test-subj on EuiToolTip is silently dropped and never appears in the DOM. It can be removed or moved to a wrapper around the tooltip

@ana-davydova
Copy link
Copy Markdown
Contributor Author

@yiannisnikolopoulos thanks!
90% - because when I found the solution and it worked, I stuck to it.
But will address your comments, as much as possible, from what I understand:

  1. Use EuiBadgeGroup + EuiBadge
    EuiBadge does support text truncation natively (via euiTextTruncate() mixin), but it only kicks in when a parent constrains the width. And EuiBadgeGroup just does flex-wrap: wrap — it has no built-in "+N more" overflow.
    Will try to combine both to simplify approach. My focus was on keeping tags to a single line (no wrapping) with a hard limit of 1 visible tag
  2. Tooltip only when truncated - oversight, will do

Two others are fully valid, on it.

@yiannisnikolopoulos
Copy link
Copy Markdown
Contributor

@ana-davydova thanks for addressing the comments. Just one small issue that I noticed, besides the following it LGTM:
Screenshot 2026-04-02 at 11 20 30 PM

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #160 / Entity Analytics - Risk Score Maintainer @ess @serverless @serverlessQA Risk Score Maintainer Entity Calculation with test log data @skipInServerless with asset criticality modifiers calculates risk scores with criticality modifiers

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
alertingVTwo 632 633 +1
observability 1889 1890 +1
total +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
alertingVTwo 270.6KB 270.9KB +214.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
alertingVTwo 153.2KB 153.8KB +536.0B
Unknown metric groups

API count

id before after diff
@kbn/alerting-v2-constants 9 10 +1

History

@yiannisnikolopoulos yiannisnikolopoulos merged commit 8b1f3e1 into elastic:main Apr 3, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:actionable-obs PRs authored by the actionable obs team backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants