Skip to content

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Sep 12, 2025

Changes

Refactor the applies_to view to contain less logic.

Context

We added comprehensive tests beforehand in #1873

@reakaleek reakaleek force-pushed the feature/refactor-applies-to branch from 8b3f7a7 to 3c1f7ad Compare September 12, 2025 09:51
@reakaleek reakaleek self-assigned this Sep 12, 2025
@reakaleek reakaleek marked this pull request as ready for review September 12, 2025 09:54
@reakaleek reakaleek requested a review from a team as a code owner September 12, 2025 09:54
@reakaleek reakaleek requested a review from Mpdreamz September 12, 2025 09:54
@reakaleek reakaleek requested a review from Copilot September 12, 2025 10:10
Copy link
Contributor

Copilot AI left a comment

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 refactors the ApplicableToComponent.cshtml view by extracting the complex rendering logic into separate classes, making the view much simpler and more maintainable.

Key changes:

  • Extracted rendering logic from the Razor view into dedicated C# classes
  • Created centralized mappings for product definitions and versioning systems
  • Simplified the view template to use a clean iteration pattern

Reviewed Changes

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

Show a summary per file
File Description
tests/authoring/Applicability/ApplicableToComponent.fs Added test case for product preview functionality
src/Elastic.Markdown/Myst/Components/ApplicableToViewModel.cs Added methods to process applicability items and extract logic from view
src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml Simplified view template by removing inline logic and using extracted methods
src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs New class containing rendering logic for applicability badges and tooltips
src/Elastic.Markdown/Myst/Components/ApplicabilityMappings.cs New static class providing centralized product definition mappings
src/Elastic.Markdown/Myst/Components/ApplicabilityItem.cs New record type for encapsulating applicability data

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

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Small nits nothing blocking.

Great to see logic moved out of the views.

@reakaleek reakaleek merged commit 0506ef5 into main Sep 14, 2025
19 checks passed
@reakaleek reakaleek deleted the feature/refactor-applies-to branch September 14, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants