Skip to content

Commit dee924f

Browse files
committed
Add ellipsis if an applies_to key has multiple lifecycles
1 parent cf810da commit dee924f

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

src/Elastic.Documentation.Site/Assets/markdown/applies-to.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
.applicable-info {
1212
@apply border-grey-20 inline-grid cursor-default grid-cols-[auto_1fr_auto] rounded-full border-[1px] bg-white pt-1.5 pr-3 pb-1.5 pl-3;
1313
}
14+
15+
.applicable-meta {
16+
@apply inline-flex gap-1.5;
17+
}
1418

1519
.applicable-name,
1620
.applicable-meta {
@@ -45,6 +49,14 @@
4549
font-size: 0.65em;
4650
}
4751
}
52+
53+
.applicable-ellipsis {
54+
@apply inline-flex gap-0.5 items-center rounded-md bg-grey-20 py-1 px-0.5 h-full;
55+
}
56+
57+
.applicable-ellipsis__dot {
58+
@apply size-1 rounded-full bg-grey-50;
59+
}
4860
}
4961

5062
.tippy-box[data-theme~='applies-to'] {

src/Elastic.Markdown/Myst/Components/ApplicabilityRenderer.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public record ApplicabilityRenderData(
1717
string TooltipText,
1818
string LifecycleClass,
1919
bool ShowLifecycleName,
20-
bool ShowVersion
20+
bool ShowVersion,
21+
bool HasMultipleLifecycles = false
2122
);
2223

2324
public ApplicabilityRenderData RenderApplicability(
@@ -58,7 +59,14 @@ public ApplicabilityRenderData RenderCombinedApplicability(
5859
var primaryRenderData = RenderApplicability(primaryApplicability, applicabilityDefinition, versioningSystem, allApplications);
5960
var combinedTooltip = BuildCombinedTooltipText(applicabilityList, applicabilityDefinition, versioningSystem);
6061

61-
return primaryRenderData with { TooltipText = combinedTooltip };
62+
// Check if there are multiple different lifecycles
63+
var hasMultipleLifecycles = applicabilityList.Select(a => a.Lifecycle).Distinct().Count() > 1;
64+
65+
return primaryRenderData with
66+
{
67+
TooltipText = combinedTooltip,
68+
HasMultipleLifecycles = hasMultipleLifecycles
69+
};
6270
}
6371

6472

@@ -89,7 +97,8 @@ private static string BuildCombinedTooltipText(
8997
return string.Join("\n\n", tooltipParts);
9098
}
9199

92-
private static string CreateApplicabilityHeading(Applicability applicability, ApplicabilityMappings.ApplicabilityDefinition applicabilityDefinition, SemVersion? realVersion)
100+
private static string CreateApplicabilityHeading(Applicability applicability, ApplicabilityMappings.ApplicabilityDefinition applicabilityDefinition,
101+
SemVersion? realVersion)
93102
{
94103
var lifecycleName = applicability.GetLifeCycleName();
95104
var versionText = realVersion is not null ? $" {realVersion}" : "";
@@ -127,8 +136,10 @@ or ProductLifecycle.Beta
127136
or ProductLifecycle.TechnicalPreview
128137
or ProductLifecycle.Planned =>
129138
$"We plan to add this functionality in a future {applicabilityDefinition.DisplayName} update. Subject to change.",
130-
ProductLifecycle.Deprecated => $"We plan to deprecate this functionality in a future {applicabilityDefinition.DisplayName} update. Subject to change.",
131-
ProductLifecycle.Removed => $"We plan to remove this functionality in a future {applicabilityDefinition.DisplayName} update. Subject to change.",
139+
ProductLifecycle.Deprecated =>
140+
$"We plan to deprecate this functionality in a future {applicabilityDefinition.DisplayName} update. Subject to change.",
141+
ProductLifecycle.Removed =>
142+
$"We plan to remove this functionality in a future {applicabilityDefinition.DisplayName} update. Subject to change.",
132143
_ => tooltipText
133144
}
134145
: $"{lifecycleFull} on {applicabilityDefinition.DisplayName} unless otherwise specified.";
@@ -142,8 +153,10 @@ or ProductLifecycle.TechnicalPreview
142153

143154
private static string? GetDisclaimer(ProductLifecycle lifecycle, VersioningSystemId versioningSystemId) => lifecycle switch
144155
{
145-
ProductLifecycle.Beta => "Beta features are subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.",
146-
ProductLifecycle.TechnicalPreview => "This functionality may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
156+
ProductLifecycle.Beta =>
157+
"Beta features are subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.",
158+
ProductLifecycle.TechnicalPreview =>
159+
"This functionality may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
147160
ProductLifecycle.GenerallyAvailable => versioningSystemId is VersioningSystemId.Stack
148161
? "If this functionality is unavailable or behaves differently when deployed on ECH, ECE, ECK, or a self-managed installation, it will be indicated on the page."
149162
: null,

src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
{
2525
@item.RenderData.BadgeLifecycleText
2626
}
27+
@if (item.RenderData.HasMultipleLifecycles)
28+
{
29+
<span class="applicable-ellipsis">
30+
<span class="applicable-ellipsis__dot"></span>
31+
<span class="applicable-ellipsis__dot"></span>
32+
<span class="applicable-ellipsis__dot"></span>
33+
</span>
34+
}
2735
</span>
2836
</span>
2937
}

0 commit comments

Comments
 (0)