From b8c05a775b25435419e49d286d42f0ec6cd4a8d4 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Tue, 1 Jul 2025 22:00:07 +0200 Subject: [PATCH 1/4] applies_to: Show GA in "Planned" if technical preview exists --- .../Myst/Components/ApplicableToComponent.cshtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml index 1a357020f..d4c167007 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml +++ b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml @@ -266,7 +266,8 @@ case ProductLifecycle.GenerallyAvailable: if (TryGetRealVersion(applicability, out var version) && version > versioningSystem.Current) { - badgeText = "Planned"; + var technicalPreviewApplicability = applications.FirstOrDefault(a => a.Lifecycle == ProductLifecycle.TechnicalPreview); + badgeText = technicalPreviewApplicability is not null ? "GA planned" : "Planned"; lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice."; lifecycleClass = "planned"; } From fdb987c3d138605f9291c22b1988626d4e6f90e6 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Tue, 1 Jul 2025 22:11:28 +0200 Subject: [PATCH 2/4] Add test --- tests/authoring/Inline/AppliesToRole.fs | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/authoring/Inline/AppliesToRole.fs b/tests/authoring/Inline/AppliesToRole.fs index 90cea9ea1..946ffd9bb 100644 --- a/tests/authoring/Inline/AppliesToRole.fs +++ b/tests/authoring/Inline/AppliesToRole.fs @@ -121,3 +121,44 @@ type ``parses multiple applies_to in one line`` () = Ece=AppliesCollection.op_Explicit "removed" ) )) + +type ``render 'GA Planned' if preview exists alongside ga`` () = + static let markdown = Setup.Markdown """ + +This is an inline {applies_to}`stack: preview 9.0, ga 9.1` element. +""" + + [] + let ``parses to AppliesDirective`` () = + let directives = markdown |> converts "index.md" |> parses + test <@ directives.Length = 1 @> + directives |> appliesToDirective (ApplicableTo( + Stack=AppliesCollection.op_Explicit "preview 9.0, ga 9.1" + )) + + [] + let ``validate HTML: generates link and alt attr`` () = + markdown |> convertsToHtml """ +

This is an inline + + + Stack + + + Planned + + + + Stack + + + GA planned + + + + element.

+""" From 75ca1bbb98b01f7e9a24dc7735119564df62086a Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Tue, 1 Jul 2025 22:17:35 +0200 Subject: [PATCH 3/4] Refactor --- .../Myst/Components/ApplicableToComponent.cshtml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml index d4c167007..2f730b491 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml +++ b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml @@ -266,8 +266,7 @@ case ProductLifecycle.GenerallyAvailable: if (TryGetRealVersion(applicability, out var version) && version > versioningSystem.Current) { - var technicalPreviewApplicability = applications.FirstOrDefault(a => a.Lifecycle == ProductLifecycle.TechnicalPreview); - badgeText = technicalPreviewApplicability is not null ? "GA planned" : "Planned"; + badgeText = applications.Any(a => a.Lifecycle == ProductLifecycle.TechnicalPreview) ? "GA planned" : "Planned"; lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice."; lifecycleClass = "planned"; } From 38d5cca0b1a26ace7ccdda757043b58d47d1d8e9 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 2 Jul 2025 09:50:09 +0200 Subject: [PATCH 4/4] Also add beta into the condition --- .../Myst/Components/ApplicableToComponent.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml index 2f730b491..91b39d0cb 100644 --- a/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml +++ b/src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml @@ -266,7 +266,7 @@ case ProductLifecycle.GenerallyAvailable: if (TryGetRealVersion(applicability, out var version) && version > versioningSystem.Current) { - badgeText = applications.Any(a => a.Lifecycle == ProductLifecycle.TechnicalPreview) ? "GA planned" : "Planned"; + badgeText = applications.Any(a => a.Lifecycle is ProductLifecycle.TechnicalPreview or ProductLifecycle.Beta) ? "GA planned" : "Planned"; lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice."; lifecycleClass = "planned"; }