Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,36 @@ public static ApplicabilityRenderData RenderApplicability(
}
}

// If we've exhausted all options (none had displayable data), use the first one.
// Only show "Planned" when the first applicability is actually future/unreleased (has a version spec that is not yet released).
// When the first applicability has no version (null/AllVersionsSpec), it means GA for all versions - keep badge text empty.
// If we've exhausted all options (none had displayable data), pick a fallback.
// When the highest-version applicability is future/unreleased, prefer the "previous lifecycle"
// (a lower-version applicability that is current or has no version) over a synthesized "Planned" badge.
Comment thread
shainaraskas marked this conversation as resolved.
if (badgeData is null && firstBadgeData is not null && firstApplicability is not null && versioningSystem.IsVersioned())
{
var versionSpec = firstApplicability.Version;
var isFutureVersion = versionSpec is not null && versionSpec != AllVersionsSpec.Instance && versionSpec.Min > versioningSystem.Current;
badgeData = isFutureVersion ? firstBadgeData with { BadgeLifecycleText = "Planned" } : firstBadgeData;

if (isFutureVersion)
{
var previousLifecycle = sortedApplicabilities.FirstOrDefault(a =>
a != firstApplicability &&
(a.Version is null || a.Version == AllVersionsSpec.Instance ||
a.Version.Min <= versioningSystem.Current));

if (previousLifecycle is not null)
badgeData = GetBadgeData(previousLifecycle, versioningSystem, allApplications);
else
{
var fallbackText = firstApplicability.Lifecycle switch
{
ProductLifecycle.Deprecated => "Deprecation planned",
ProductLifecycle.Removed => "Removal planned",
_ => "Planned"
};
badgeData = firstBadgeData with { BadgeLifecycleText = fallbackText, ShowLifecycleName = false };
}
}
else
badgeData = firstBadgeData;
}

badgeData ??= GetBadgeData(sortedApplicabilities.First(), versioningSystem, allApplications);
Expand Down
Loading