From f5cb51e442cd3838ad021921f06e0e46d48a0871 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Mon, 11 Aug 2025 20:10:47 -0700 Subject: [PATCH 1/4] update applies_to render order Signed-off-by: bmorelli25 --- .../Components/ApplicableToComponent.cshtml | 162 +++++++++--------- .../Applicability/AppliesToFrontMatter.fs | 23 +++ 2 files changed, 104 insertions(+), 81 deletions(-) diff --git a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml index fcc8f897f..08947c344 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml +++ b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml @@ -18,47 +18,6 @@ appliesTo.Stack ) } -@if (appliesTo.Deployment is not null) -{ - if (appliesTo.Deployment.Ece is not null) - { - @RenderProduct("ECE", - "Elastic Cloud Enterprise", - VersioningSystemId.Ece, - appliesTo.Deployment.Ece - ) - } - - if (appliesTo.Deployment.Eck is not null) - { - @RenderProduct( - "ECK", - "Elastic Cloud on Kubernetes", - VersioningSystemId.Eck, - appliesTo.Deployment.Eck - ) - } - - if (appliesTo.Deployment.Ess is not null) - { - @RenderProduct( - "ECH", - "Elastic Cloud Hosted", - VersioningSystemId.Ess, - appliesTo.Deployment.Ess - ) - } - - if (appliesTo.Deployment.Self is not null) - { - @RenderProduct( - "Self-Managed", - "Self-managed Elastic deployments", - VersioningSystemId.Self, - appliesTo.Deployment.Self - ) - } -} @if (appliesTo.Serverless is not null) { if (appliesTo.Serverless.AllProjects is not null) @@ -103,9 +62,46 @@ } } } -@if (appliesTo.Product is not null) +@if (appliesTo.Deployment is not null) { - @RenderProduct("", "", VersioningSystemId.All, appliesTo.Product) + if (appliesTo.Deployment.Ece is not null) + { + @RenderProduct("ECE", + "Elastic Cloud Enterprise", + VersioningSystemId.Ece, + appliesTo.Deployment.Ece + ) + } + + if (appliesTo.Deployment.Eck is not null) + { + @RenderProduct( + "ECK", + "Elastic Cloud on Kubernetes", + VersioningSystemId.Eck, + appliesTo.Deployment.Eck + ) + } + + if (appliesTo.Deployment.Ess is not null) + { + @RenderProduct( + "ECH", + "Elastic Cloud Hosted", + VersioningSystemId.Ess, + appliesTo.Deployment.Ess + ) + } + + if (appliesTo.Deployment.Self is not null) + { + @RenderProduct( + "Self-Managed", + "Self-managed Elastic deployments", + VersioningSystemId.Self, + appliesTo.Deployment.Self + ) + } } @if (appliesTo.ProductApplicability is not null) { @@ -120,101 +116,105 @@ @RenderProduct("Curator", "Curator", VersioningSystemId.Curator, pa.Curator) } - if (pa.ApmAgentAndroid is not null) + if (pa.EdotAndroid is not null) { - @RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid) + @RenderProduct("EDOT Android", "Elastic Distribution of OpenTelemetry Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid) } - if (pa.ApmAgentDotnet is not null) + if (pa.EdotCfAws is not null) { - @RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet) + @RenderProduct("EDOT CF AWS", "Elastic Distribution of OpenTelemetry Cloud Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws) } - if (pa.ApmAgentGo is not null) + if (pa.EdotCollector is not null) { - @RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo) + @RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector) } - if (pa.ApmAgentIos is not null) + if (pa.EdotDotnet is not null) { - @RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos) + @RenderProduct("EDOT .NET", "Elastic Distribution of OpenTelemetry .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet) } - if (pa.ApmAgentJava is not null) + if (pa.EdotIos is not null) { - @RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava) + @RenderProduct("EDOT iOS", "Elastic Distribution of OpenTelemetry iOS", VersioningSystemId.EdotIos, pa.EdotIos) } - if (pa.ApmAgentNode is not null) + if (pa.EdotJava is not null) { - @RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode) + @RenderProduct("EDOT Java", "Elastic Distribution of OpenTelemetry Java", VersioningSystemId.EdotJava, pa.EdotJava) } - if (pa.ApmAgentPhp is not null) + if (pa.EdotNode is not null) { - @RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp) + @RenderProduct("EDOT Node.js", "Elastic Distribution of OpenTelemetry Node.js", VersioningSystemId.EdotNode, pa.EdotNode) } - if (pa.ApmAgentPython is not null) + if (pa.EdotPhp is not null) { - @RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython) + @RenderProduct("EDOT PHP", "Elastic Distribution of OpenTelemetry PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp) } - if (pa.ApmAgentRuby is not null) + if (pa.EdotPython is not null) { - @RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby) + @RenderProduct("EDOT Python", "Elastic Distribution of OpenTelemetry Python", VersioningSystemId.EdotPython, pa.EdotPython) } - if (pa.ApmAgentRum is not null) + if (pa.ApmAgentAndroid is not null) { - @RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum) + @RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid) } - if (pa.EdotIos is not null) + if (pa.ApmAgentDotnet is not null) { - @RenderProduct("EDOT iOS", "Elastic Distribution of OpenTelemetry iOS", VersioningSystemId.EdotIos, pa.EdotIos) + @RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet) } - if (pa.EdotAndroid is not null) + if (pa.ApmAgentGo is not null) { - @RenderProduct("EDOT Android", "Elastic Distribution of OpenTelemetry Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid) + @RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo) } - if (pa.EdotDotnet is not null) + if (pa.ApmAgentIos is not null) { - @RenderProduct("EDOT .NET", "Elastic Distribution of OpenTelemetry .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet) + @RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos) } - if (pa.EdotJava is not null) + if (pa.ApmAgentJava is not null) { - @RenderProduct("EDOT Java", "Elastic Distribution of OpenTelemetry Java", VersioningSystemId.EdotJava, pa.EdotJava) + @RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava) } - if (pa.EdotNode is not null) + if (pa.ApmAgentNode is not null) { - @RenderProduct("EDOT Node.js", "Elastic Distribution of OpenTelemetry Node.js", VersioningSystemId.EdotNode, pa.EdotNode) + @RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode) } - if (pa.EdotPhp is not null) + if (pa.ApmAgentPhp is not null) { - @RenderProduct("EDOT PHP", "Elastic Distribution of OpenTelemetry PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp) + @RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp) } - if (pa.EdotPython is not null) + if (pa.ApmAgentPython is not null) { - @RenderProduct("EDOT Python", "Elastic Distribution of OpenTelemetry Python", VersioningSystemId.EdotPython, pa.EdotPython) + @RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython) } - if (pa.EdotCfAws is not null) + if (pa.ApmAgentRuby is not null) { - @RenderProduct("EDOT CF AWS", "Elastic Distribution of OpenTelemetry Cloud Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws) + @RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby) } - if (pa.EdotCollector is not null) + if (pa.ApmAgentRum is not null) { - @RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector) + @RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum) } } +@if (appliesTo.Product is not null) +{ + @RenderProduct("", "", VersioningSystemId.All, appliesTo.Product) +} @functions { diff --git a/tests/authoring/Applicability/AppliesToFrontMatter.fs b/tests/authoring/Applicability/AppliesToFrontMatter.fs index 6b82c266a..d6a487adb 100644 --- a/tests/authoring/Applicability/AppliesToFrontMatter.fs +++ b/tests/authoring/Applicability/AppliesToFrontMatter.fs @@ -212,3 +212,26 @@ applies_to: [] let ``does not render label`` () = markdown |> appliesTo (Unchecked.defaultof) + +type ``parses applies_to with multiple categories in any order`` () = + static let markdown = frontMatter """ +applies_to: + product: ga + deployment: + eck: ga 9.0 + serverless: + security: ga 9.0.0 + stack: ga 9.1 +""" + [] + let ``parses all categories regardless of YAML order`` () = + markdown |> appliesTo (ApplicableTo( + Stack=AppliesCollection.op_Explicit "ga 9.1", + Serverless=ServerlessProjectApplicability( + Security=AppliesCollection.op_Explicit "ga 9.0.0" + ), + Deployment=DeploymentApplicability( + Eck=AppliesCollection.op_Explicit "ga 9.0" + ), + Product=AppliesCollection.op_Explicit "ga" + )) From b71689ec0d3acddc3b81205bdc1d52cec4bfcf00 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Mon, 11 Aug 2025 20:18:12 -0700 Subject: [PATCH 2/4] more complex test Signed-off-by: bmorelli25 --- tests/authoring/Applicability/AppliesToFrontMatter.fs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/authoring/Applicability/AppliesToFrontMatter.fs b/tests/authoring/Applicability/AppliesToFrontMatter.fs index d6a487adb..289c73a8e 100644 --- a/tests/authoring/Applicability/AppliesToFrontMatter.fs +++ b/tests/authoring/Applicability/AppliesToFrontMatter.fs @@ -222,6 +222,8 @@ applies_to: serverless: security: ga 9.0.0 stack: ga 9.1 + ecctl: ga 10.0 + apm_agent_dotnet: ga 9.0 """ [] let ``parses all categories regardless of YAML order`` () = @@ -233,5 +235,9 @@ applies_to: Deployment=DeploymentApplicability( Eck=AppliesCollection.op_Explicit "ga 9.0" ), + ProductApplicability=ProductApplicability( + Ecctl=AppliesCollection.op_Explicit "ga 10.0", + ApmAgentDotnet=AppliesCollection.op_Explicit "ga 9.0" + ), Product=AppliesCollection.op_Explicit "ga" )) From 6ef43d37d9790ef4be268694a9dc9f642bada9d0 Mon Sep 17 00:00:00 2001 From: bmorelli25 Date: Mon, 11 Aug 2025 20:21:35 -0700 Subject: [PATCH 3/4] Add brief docs Signed-off-by: bmorelli25 --- docs/syntax/applies.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/syntax/applies.md b/docs/syntax/applies.md index 8de237b32..141b09772 100644 --- a/docs/syntax/applies.md +++ b/docs/syntax/applies.md @@ -20,6 +20,18 @@ applicability with precision. :::{include} /contribute/_snippets/tag-processing.md ::: +### Badge Rendering Order + +The applies_to badges are displayed in a consistent, logical order regardless of how they appear in your source files. This ensures users always see badges in a predictable hierarchy: + +1. **Stack** - Elastic Stack +2. **Serverless** - Elastic Cloud Serverless offerings +3. **Deployment** - Deployment options (ECE, ECK, ECH, Self-Managed) +4. **ProductApplicability** - Specialized tools and agents (ECCTL, Curator, EDOT, APM Agents) +5. **Product (generic)** - Generic product applicability + +Within the ProductApplicability category, EDOT and APM Agent items are sorted alphabetically for easy scanning. + ## When and where to use `applies_to` The `applies_to` metadata can be added at different levels in the documentation: From 90d93089bea0783edfa5ab153e8f68baccffaf72 Mon Sep 17 00:00:00 2001 From: Brandon Morelli Date: Mon, 11 Aug 2025 20:23:47 -0700 Subject: [PATCH 4/4] clean --- docs/syntax/applies.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/syntax/applies.md b/docs/syntax/applies.md index 141b09772..104d48616 100644 --- a/docs/syntax/applies.md +++ b/docs/syntax/applies.md @@ -20,9 +20,9 @@ applicability with precision. :::{include} /contribute/_snippets/tag-processing.md ::: -### Badge Rendering Order +### Badge rendering order -The applies_to badges are displayed in a consistent, logical order regardless of how they appear in your source files. This ensures users always see badges in a predictable hierarchy: +`applies_to` badges are displayed in a consistent order regardless of how they appear in your source files. This ensures users always see badges in a predictable hierarchy: 1. **Stack** - Elastic Stack 2. **Serverless** - Elastic Cloud Serverless offerings