Skip to content

Commit 826c3ba

Browse files
Refined applies_to tooltips (#1495)
* Refined `applies_to` tooltips * Add non breaking spaces * Fix test * Apply suggestion from @florent-leborgne * Apply suggestion from @florent-leborgne * Apply suggestion from @florent-leborgne * Apply suggestion from @florent-leborgne * Apply suggestion from @florent-leborgne * Apply suggestion from @florent-leborgne * Apply suggestion from @florent-leborgne * Also handle the existing and still used 'planned' lifecycle --------- Co-authored-by: florent-leborgne <[email protected]>
1 parent 8dab793 commit 826c3ba

File tree

2 files changed

+110
-104
lines changed

2 files changed

+110
-104
lines changed

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

Lines changed: 98 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
@RenderProduct(
1414
"Stack",
15-
"Part of the versioned Elastic Stack\n\nAvailable in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated",
15+
"Elastic&nbsp;Stack",
1616
VersioningSystemId.Stack,
1717
appliesTo.Stack
1818
)
@@ -22,7 +22,7 @@
2222
if (appliesTo.Deployment.Ece is not null)
2323
{
2424
@RenderProduct("ECE",
25-
"Elastic Cloud Enterprise",
25+
"Elastic&nbsp;Cloud&nbsp;Enterprise",
2626
VersioningSystemId.Ece,
2727
appliesTo.Deployment.Ece
2828
)
@@ -32,7 +32,7 @@
3232
{
3333
@RenderProduct(
3434
"ECK",
35-
"Elastic Cloud on Kubernetes",
35+
"Elastic&nbsp;Cloud&nbsp;on&nbsp;Kubernetes",
3636
VersioningSystemId.Eck,
3737
appliesTo.Deployment.Eck
3838
)
@@ -42,7 +42,7 @@
4242
{
4343
@RenderProduct(
4444
"ECH",
45-
"Elastic Cloud Hosted",
45+
"Elastic&nbsp;Cloud&nbsp;Hosted",
4646
VersioningSystemId.Ess,
4747
appliesTo.Deployment.Ess
4848
)
@@ -52,7 +52,7 @@
5252
{
5353
@RenderProduct(
5454
"Self-Managed",
55-
"Self-managed Elastic deployments",
55+
"Self-managed Elastic&nbsp;deployments",
5656
VersioningSystemId.Self,
5757
appliesTo.Deployment.Self
5858
)
@@ -64,7 +64,7 @@
6464
{
6565
@RenderProduct(
6666
"Serverless",
67-
"Elastic Cloud Serverless: Fully-managed Elastic, available in Elastic Cloud",
67+
"Elastic&nbsp;Cloud&nbsp;Serverless",
6868
VersioningSystemId.Serverless,
6969
appliesTo.Serverless.AllProjects
7070
)
@@ -75,7 +75,7 @@
7575
{
7676
@RenderProduct(
7777
"Serverless Elasticsearch",
78-
"Serverless Elasticsearch projects",
78+
"Serverless&nbsp;Elasticsearch projects",
7979
VersioningSystemId.Elasticsearch,
8080
appliesTo.Serverless.Elasticsearch
8181
)
@@ -85,7 +85,7 @@
8585
{
8686
@RenderProduct(
8787
"Serverless Observability",
88-
"Serverless Observability projects",
88+
"Serverless&nbsp;Observability projects",
8989
VersioningSystemId.Observability,
9090
appliesTo.Serverless.Observability
9191
)
@@ -95,7 +95,7 @@
9595
{
9696
@RenderProduct(
9797
"Serverless Security",
98-
"Serverless Security projects",
98+
"Serverless&nbsp;Security projects",
9999
VersioningSystemId.Security,
100100
appliesTo.Serverless.Security
101101
)
@@ -111,121 +111,121 @@
111111
var pa = appliesTo.ProductApplicability;
112112
if (pa.Ecctl is not null)
113113
{
114-
@RenderProduct("ECCTL", "Elastic Cloud Control", VersioningSystemId.Ecctl, pa.Ecctl)
114+
@RenderProduct("ECCTL", "Elastic&nbsp;Cloud&nbsp;Control", VersioningSystemId.Ecctl, pa.Ecctl)
115115
;
116116
}
117117

118118
if (pa.Curator is not null)
119119
{
120-
@RenderProduct("Curator", "", VersioningSystemId.Curator, pa.Curator)
120+
@RenderProduct("Curator", "Curator", VersioningSystemId.Curator, pa.Curator)
121121
;
122122
}
123123

124124
if (pa.ApmAgentAndroid is not null)
125125
{
126-
@RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
126+
@RenderProduct("APM Agent Android", "Application&nbsp;Performance&nbsp;Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
127127
;
128128
}
129129

130130
if (pa.ApmAgentDotnet is not null)
131131
{
132-
@RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
132+
@RenderProduct("APM Agent .NET", "Application&nbsp;Performance&nbsp;Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
133133
;
134134
}
135135

136136
if (pa.ApmAgentGo is not null)
137137
{
138-
@RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
138+
@RenderProduct("APM Agent Go", "Application&nbsp;Performance&nbsp;Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
139139
;
140140
}
141141

142142
if (pa.ApmAgentIos is not null)
143143
{
144-
@RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
144+
@RenderProduct("APM Agent iOS", "Application&nbsp;Performance&nbsp;Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
145145
;
146146
}
147147

148148
if (pa.ApmAgentJava is not null)
149149
{
150-
@RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
150+
@RenderProduct("APM Agent Java", "Application&nbsp;Performance&nbsp;Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
151151
;
152152
}
153153

154154
if (pa.ApmAgentNode is not null)
155155
{
156-
@RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
156+
@RenderProduct("APM Agent Node.js", "Application&nbsp;Performance&nbsp;Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
157157
;
158158
}
159159

160160
if (pa.ApmAgentPhp is not null)
161161
{
162-
@RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
162+
@RenderProduct("APM Agent PHP", "Application&nbsp;Performance&nbsp;Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
163163
;
164164
}
165165

166166
if (pa.ApmAgentPython is not null)
167167
{
168-
@RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
168+
@RenderProduct("APM Agent Python", "Application&nbsp;Performance&nbsp;Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
169169
;
170170
}
171171

172172
if (pa.ApmAgentRuby is not null)
173173
{
174-
@RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
174+
@RenderProduct("APM Agent Ruby", "Application&nbsp;Performance&nbsp;Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
175175
;
176176
}
177177

178178
if (pa.ApmAgentRum is not null)
179179
{
180-
@RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
180+
@RenderProduct("APM Agent RUM", "Application&nbsp;Performance&nbsp;Monitoring Agent for Real&nbsp;User&nbsp;Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
181181
;
182182
}
183183

184184
if (pa.EdotIos is not null)
185185
{
186-
@RenderProduct("EDOT iOS", "Elastic Distribution of OpenTelemetry iOS", VersioningSystemId.EdotIos, pa.EdotIos)
186+
@RenderProduct("EDOT iOS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;iOS", VersioningSystemId.EdotIos, pa.EdotIos)
187187
;
188188
}
189189

190190
if (pa.EdotAndroid is not null)
191191
{
192-
@RenderProduct("EDOT Android", "Elastic Distribution of OpenTelemetry Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
192+
@RenderProduct("EDOT Android", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
193193
;
194194
}
195195

196196
if (pa.EdotDotnet is not null)
197197
{
198-
@RenderProduct("EDOT .NET", "Elastic Distribution of OpenTelemetry .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
198+
@RenderProduct("EDOT .NET", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;.NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
199199
;
200200
}
201201

202202
if (pa.EdotJava is not null)
203203
{
204-
@RenderProduct("EDOT Java", "Elastic Distribution of OpenTelemetry Java", VersioningSystemId.EdotJava, pa.EdotJava)
204+
@RenderProduct("EDOT Java", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Java", VersioningSystemId.EdotJava, pa.EdotJava)
205205
;
206206
}
207207

208208
if (pa.EdotNode is not null)
209209
{
210-
@RenderProduct("EDOT Node.js", "Elastic Distribution of OpenTelemetry Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
210+
@RenderProduct("EDOT Node.js", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
211211
;
212212
}
213213

214214
if (pa.EdotPhp is not null)
215215
{
216-
@RenderProduct("EDOT PHP", "Elastic Distribution of OpenTelemetry PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
216+
@RenderProduct("EDOT PHP", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
217217
;
218218
}
219219

220220
if (pa.EdotPython is not null)
221221
{
222-
@RenderProduct("EDOT Python", "Elastic Distribution of OpenTelemetry Python", VersioningSystemId.EdotPython, pa.EdotPython)
222+
@RenderProduct("EDOT Python", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Python", VersioningSystemId.EdotPython, pa.EdotPython)
223223
;
224224
}
225225

226226
if (pa.EdotCfAws is not null)
227227
{
228-
@RenderProduct("EDOT CF AWS", "Elastic Distribution of OpenTelemetry Cloud Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
228+
@RenderProduct("EDOT CF AWS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Cloud&nbsp;Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
229229
;
230230
}
231231

@@ -238,94 +238,100 @@
238238

239239
@functions {
240240

241-
private IHtmlContent RenderProduct(string name, string description, VersioningSystemId versioningSystemName, AppliesCollection applications)
241+
private IHtmlContent RenderProduct(string key, string keyFull, VersioningSystemId versioningSystemName, AppliesCollection applications)
242242
{
243243
var versioningSystem = Model.VersionsConfig.GetVersioningSystem(versioningSystemName);
244244

245245
foreach (var applicability in applications)
246246
{
247-
var lifecycleTooltip = "";
248-
var badgeText = name;
247+
var badgeText = key;
248+
var tooltipText = "";
249249
var lifecycleClass = applicability.GetLifeCycleName().ToLowerInvariant().Replace(" ", "-");
250-
switch (applicability.Lifecycle)
250+
251+
var lifecycleFull = applicability.Lifecycle switch
252+
{
253+
ProductLifecycle.GenerallyAvailable => "Available",
254+
ProductLifecycle.Beta => "Available in beta",
255+
ProductLifecycle.TechnicalPreview => "Available in technical preview",
256+
ProductLifecycle.Deprecated => "Deprecated",
257+
ProductLifecycle.Removed => "Removed",
258+
_ => ""
259+
};
260+
261+
var realVersion = TryGetRealVersion(applicability, out var v) ? v : null;
262+
263+
if (realVersion is not null)
251264
{
252-
case ProductLifecycle.TechnicalPreview:
253-
if (TryGetRealVersion(applicability, out var previewVersion) && previewVersion > versioningSystem.Current)
254-
{
255-
badgeText = "Planned";
256-
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
257-
lifecycleClass = "planned";
258-
}
259-
else
260-
{
261-
lifecycleTooltip = "This functionality is in technical preview and 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.";
262-
}
263-
264-
break;
265-
case ProductLifecycle.Beta:
266-
if (TryGetRealVersion(applicability, out var betaVersion) && betaVersion > versioningSystem.Current)
267-
{
268-
badgeText = "Planned";
269-
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
270-
lifecycleClass = "planned";
271-
}
272-
else
273-
{
274-
lifecycleTooltip = "This functionality is in beta and is 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.";
275-
}
276-
277-
break;
278-
case ProductLifecycle.GenerallyAvailable:
279-
if (TryGetRealVersion(applicability, out var version) && version > versioningSystem.Current)
280-
{
281-
badgeText = applications.Any(a => a.Lifecycle is ProductLifecycle.TechnicalPreview or ProductLifecycle.Beta) ? "GA planned" : "Planned";
282-
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
283-
lifecycleClass = "planned";
284-
}
285265

286-
break;
287-
case ProductLifecycle.Deprecated:
288-
if (TryGetRealVersion(applicability, out var deprecatedVersion) && deprecatedVersion > versioningSystem.Current)
266+
if (realVersion <= versioningSystem.Current)
267+
{
268+
tooltipText = $"{lifecycleFull} on {keyFull} version {realVersion} and later unless otherwise specified.";
269+
}
270+
else
271+
{
272+
tooltipText = applicability.Lifecycle switch
289273
{
290-
badgeText = "Deprecation planned";
291-
lifecycleTooltip = "We plan to deprecate this functionality in a future update. Plans may change without notice.";
292-
}
274+
ProductLifecycle.GenerallyAvailable
275+
or ProductLifecycle.Beta
276+
or ProductLifecycle.TechnicalPreview
277+
or ProductLifecycle.Planned =>
278+
$"We plan to add this functionality in a future {keyFull} update. Subject to change.",
279+
ProductLifecycle.Deprecated => $"We plan to deprecate this functionality in a future {keyFull} update. Subject to change.",
280+
ProductLifecycle.Removed => $"We plan to remove this functionality in a future {keyFull} update. Subject to change.",
281+
_ => tooltipText
282+
};
283+
}
284+
285+
}
286+
else
287+
{
288+
tooltipText = $"{lifecycleFull} on {keyFull} unless otherwise specified.";
289+
}
293290

294-
break;
295-
case ProductLifecycle.Removed:
296-
if (TryGetRealVersion(applicability, out var removedVersion) && removedVersion > versioningSystem.Current)
297-
{
298-
badgeText = "Removal planned";
299-
lifecycleTooltip = "We plan to remove this functionality in a future update. Plans may change without notice.";
300-
}
291+
var disclaimer = applicability.Lifecycle switch
292+
{
293+
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.",
294+
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.",
295+
ProductLifecycle.GenerallyAvailable => versioningSystem.Id is VersioningSystemId.Stack ? "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." : null,
296+
_ => null
297+
};
301298

302-
break;
299+
if (disclaimer is not null)
300+
{
301+
tooltipText = $"{tooltipText}\n\n{disclaimer}";
303302
}
304303

305-
if (
306-
applicability.Version is null
307-
&& applicability.Lifecycle != ProductLifecycle.Deprecated
308-
&& applicability.Lifecycle != ProductLifecycle.Removed
309-
&& versioningSystem.Id is VersioningSystemId.Stack or VersioningSystemId.Self or VersioningSystemId.Ece or VersioningSystemId.Eck
310-
)
304+
if (realVersion is not null && realVersion > versioningSystem.Current)
311305
{
312-
lifecycleTooltip += $"\n\nApplies to version {versioningSystem.Base} and later - may have been introduced in a previous version";
306+
badgeText = applicability.Lifecycle switch
307+
{
308+
ProductLifecycle.TechnicalPreview => "Planned",
309+
ProductLifecycle.Beta => "Planned",
310+
ProductLifecycle.GenerallyAvailable =>
311+
applications.Any(a => a.Lifecycle is ProductLifecycle.TechnicalPreview or ProductLifecycle.Beta)
312+
? "GA planned"
313+
: "Planned",
314+
ProductLifecycle.Deprecated => "Deprecation planned",
315+
ProductLifecycle.Removed => "Removal planned",
316+
ProductLifecycle.Planned => "Planned",
317+
_ => badgeText
318+
};
313319
}
314320

315-
var badgeTextChanged = badgeText != name;
316-
<span class="applicable-info">
317-
<span class="applicable-name" data-tippy-content="@description">@name</span>
321+
var badgeTextChanged = badgeText != key;
322+
<span class="applicable-info" data-tippy-content="@(new HtmlString(tooltipText))">
323+
<span class="applicable-name">@key</span>
318324

319325
@{
320326
var showLifeCycle = applicability.Lifecycle != ProductLifecycle.GenerallyAvailable && !badgeTextChanged;
321327
var showVersion = applicability.Version is not null and not AllVersions;
322328
}
323329

324-
@if (!string.IsNullOrEmpty(name) && (showLifeCycle || showVersion))
330+
@if (!string.IsNullOrEmpty(key) && (showLifeCycle || showVersion))
325331
{
326332
<span class="applicable-separator"></span>
327333
}
328-
<span class="applicable-meta applicable-meta-@lifecycleClass" data-tippy-content="@lifecycleTooltip">
334+
<span class="applicable-meta applicable-meta-@lifecycleClass">
329335
@if (showLifeCycle)
330336
{
331337
<span

0 commit comments

Comments
 (0)