Skip to content

Combine applies_to badges with the same key - #1900

Merged
reakaleek merged 12 commits into
mainfrom
feature/combine-applicability-items
Sep 23, 2025
Merged

reakaleek merged 12 commits into
mainfrom
feature/combine-applicability-items

Conversation

@reakaleek

@reakaleek reakaleek commented Sep 17, 2025 •

Copy link
Copy Markdown
Member

Part of #1709

Changes

  • Combine applies_to badges with the same key into one badge
  • Show the lifecycle that is closest to the current version.
  • The tooltip text is combined from both lifecycles.

Follow-ups

  • This is done in preparation for the new applies_to popover.

@reakaleek
reakaleek requested a review from a team as a code owner September 17, 2025 12:55
@reakaleek
reakaleek requested a review from cotti September 17, 2025 12:55
@reakaleek reakaleek self-assigned this Sep 17, 2025
@reakaleek
reakaleek requested a review from Copilot September 18, 2025 12:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR combines applies_to badges with the same key into a single badge to reduce redundancy in the UI. The combined badge shows the lifecycle closest to the current version and combines tooltip text from all lifecycles.

  • Combines multiple applies_to badges with identical keys into a single badge display
  • Implements primary applicability selection logic that prioritizes available versions over future ones
  • Modifies tooltip text to include combined information from all lifecycles

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ApplicableToViewModel.cs Adds badge combination logic and primary applicability selection
ApplicabilityRenderer.cs Implements combined tooltip text generation and primary selection
ApplicabilityItem.cs Updates record structure to support primary applicability
ApplicableToComponent.cshtml Updates template to use primary applicability
Test files Updates test expectations for combined badge behavior
ApplicabilityMappings.cs Minor formatting change

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…ector utility class

- Created new ApplicabilitySelector class in Elastic.Documentation.AppliesTo namespace
- Removed duplicated GetPrimaryApplicability method from ApplicabilityRenderer and ApplicableToViewModel
- Updated both classes to use the new utility class
- Improves code reusability and reduces duplication
- Moved ApplicabilitySelector from Elastic.Documentation to Elastic.Markdown.Myst.Components
- Added missing using statements for AllVersions and SemVersion
- All tests now pass successfully
…o domain layer

- Changed parameter from VersioningSystem to SemVersion currentVersion
- Moved ApplicabilitySelector back to Elastic.Documentation.AppliesTo namespace
- Updated callers to pass versioningSystem.Current
- Simplified interface and improved domain separation
- All tests pass successfully
@florent-leborgne

Copy link
Copy Markdown
Member

Currently testing. This is what I'm seeing right now:
image

I think that in order to be shippable standalone and still make sense (rest of the changes will be made separately), we'd need at least the following tweaks made as part of this same PR:

  • Include the ellipsis on the badge in case of multiple states
  • Also only in case of multiple states (if preview or beta exist in addition to GA), the badge should include "GA"
  • Bold the 1st line of each "state" in the tooltip, and optionally add a separator between each state section

I assume you'd rather keep tooltip information ordering for later but if those are simple to change, I'm also happy to provide input on this here.

@reakaleek Thanks for working on this!

Bold heading and separator
@reakaleek

reakaleek commented Sep 19, 2025 •

Copy link
Copy Markdown
Member Author

Updates:

Tooltip styling

image

cf810da

Ellipsis

dee924f

Show GA in multi state

dc03b11

image

@Mpdreamz Mpdreamz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

small nits

@reakaleek
reakaleek requested a review from Mpdreamz September 22, 2025 10:40

@florent-leborgne florent-leborgne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @reakaleek! Just tested and looks good from what I could see :D

@reakaleek
reakaleek merged commit d05760c into main Sep 23, 2025
@reakaleek
reakaleek deleted the feature/combine-applicability-items branch September 23, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants