Skip to content

Commit 792ff13

Browse files
committed
Fix test
1 parent 61fe02f commit 792ff13

File tree

2 files changed

+149
-48
lines changed

2 files changed

+149
-48
lines changed

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

Lines changed: 145 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@if (appliesTo.Stack is not null)
1212
{
1313
@RenderProduct(
14-
"Stack",
14+
"Stack",
1515
"Part of the versioned Elastic Stack\n\nAvailable in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated",
1616
VersioningSystemId.Stack,
1717
appliesTo.Stack
@@ -21,34 +21,37 @@
2121
{
2222
if (appliesTo.Deployment.Ece is not null)
2323
{
24-
@RenderProduct("ECE",
24+
@RenderProduct("ECE",
2525
"Elastic Cloud Enterprise",
26-
VersioningSystemId.Ece,
26+
VersioningSystemId.Ece,
2727
appliesTo.Deployment.Ece
2828
)
2929
}
30+
3031
if (appliesTo.Deployment.Eck is not null)
3132
{
3233
@RenderProduct(
33-
"ECK",
34+
"ECK",
3435
"Elastic Cloud on Kubernetes",
35-
VersioningSystemId.Eck,
36+
VersioningSystemId.Eck,
3637
appliesTo.Deployment.Eck
3738
)
3839
}
40+
3941
if (appliesTo.Deployment.Ess is not null)
4042
{
4143
@RenderProduct(
42-
"ECH",
43-
"Elastic Cloud Hosted",
44+
"ECH",
45+
"Elastic Cloud Hosted",
4446
VersioningSystemId.Ess,
4547
appliesTo.Deployment.Ess
4648
)
4749
}
50+
4851
if (appliesTo.Deployment.Self is not null)
4952
{
5053
@RenderProduct(
51-
"Self-Managed",
54+
"Self-Managed",
5255
"Self-managed Elastic deployments",
5356
VersioningSystemId.Self,
5457
appliesTo.Deployment.Self
@@ -60,9 +63,9 @@
6063
if (appliesTo.Serverless.AllProjects is not null)
6164
{
6265
@RenderProduct(
63-
"Serverless",
66+
"Serverless",
6467
"Elastic Cloud Serverless: Fully-managed Elastic, available in Elastic Cloud",
65-
VersioningSystemId.Serverless,
68+
VersioningSystemId.Serverless,
6669
appliesTo.Serverless.AllProjects
6770
)
6871
}
@@ -77,27 +80,27 @@
7780
appliesTo.Serverless.Elasticsearch
7881
)
7982
}
83+
8084
if (appliesTo.Serverless.Observability is not null)
8185
{
8286
@RenderProduct(
83-
"Serverless Observability",
84-
"Serverless Observability projects",
87+
"Serverless Observability",
88+
"Serverless Observability projects",
8589
VersioningSystemId.Observability,
8690
appliesTo.Serverless.Observability
8791
)
8892
}
93+
8994
if (appliesTo.Serverless.Security is not null)
9095
{
9196
@RenderProduct(
9297
"Serverless Security",
9398
"Serverless Security projects",
94-
VersioningSystemId.Security,
99+
VersioningSystemId.Security,
95100
appliesTo.Serverless.Security
96101
)
97102
}
98-
99103
}
100-
101104
}
102105
@if (appliesTo.Product is not null)
103106
{
@@ -106,38 +109,129 @@
106109
@if (appliesTo.ProductApplicability is not null)
107110
{
108111
var pa = appliesTo.ProductApplicability;
109-
if (pa.Ecctl is not null) {
112+
if (pa.Ecctl is not null)
113+
{
110114
@RenderProduct("ECCTL", "Elastic Cloud Control", VersioningSystemId.Ecctl, pa.Ecctl)
111-
; }
112-
if (pa.Curator is not null) { @RenderProduct("Curator", "", VersioningSystemId.Curator, pa.Curator); }
113-
if (pa.ApmAgentAndroid is not null) { @RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid); }
114-
if (pa.ApmAgentDotnet is not null) { @RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet); }
115-
if (pa.ApmAgentGo is not null) { @RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo); }
116-
if (pa.ApmAgentIos is not null) { @RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos); }
117-
if (pa.ApmAgentJava is not null) { @RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava); }
118-
if (pa.ApmAgentNode is not null) { @RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode); }
119-
if (pa.ApmAgentPhp is not null) { @RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp); }
120-
if (pa.ApmAgentPython is not null) { @RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython); }
121-
if (pa.ApmAgentRuby is not null) { @RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby); }
122-
if (pa.ApmAgentRum is not null) { @RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum); }
123-
if (pa.EdotIos is not null) { @RenderProduct("EDOT iOS", "Elastic Distributions of OpenTelemetry for iOS", VersioningSystemId.EdotIos, pa.EdotIos); }
124-
if (pa.EdotAndroid is not null) { @RenderProduct("EDOT Android", "Elastic Distributions of OpenTelemetry for Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid); }
125-
if (pa.EdotDotnet is not null) { @RenderProduct("EDOT .NET", " Elastic Distributions of OpenTelemetry for .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet); }
126-
if (pa.EdotJava is not null) { @RenderProduct("EDOT Java", "Elastic Distributions of OpenTelemetry for Java", VersioningSystemId.EdotJava, pa.EdotJava); }
127-
if (pa.EdotNode is not null) { @RenderProduct("EDOT Node.js", "Elastic Distributions of OpenTelemetry for Node.js", VersioningSystemId.EdotNode, pa.EdotNode); }
128-
if (pa.EdotPhp is not null) { @RenderProduct("EDOT PHP", "Elastic Distributions of OpenTelemetry for PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp); }
129-
if (pa.EdotPython is not null) { @RenderProduct("EDOT Python", "Elastic Distributions of OpenTelemetry for Python", VersioningSystemId.EdotPython, pa.EdotPython); }
115+
;
116+
}
117+
118+
if (pa.Curator is not null)
119+
{
120+
@RenderProduct("Curator", "", VersioningSystemId.Curator, pa.Curator)
121+
;
122+
}
123+
124+
if (pa.ApmAgentAndroid is not null)
125+
{
126+
@RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
127+
;
128+
}
129+
130+
if (pa.ApmAgentDotnet is not null)
131+
{
132+
@RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
133+
;
134+
}
135+
136+
if (pa.ApmAgentGo is not null)
137+
{
138+
@RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
139+
;
140+
}
141+
142+
if (pa.ApmAgentIos is not null)
143+
{
144+
@RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
145+
;
146+
}
147+
148+
if (pa.ApmAgentJava is not null)
149+
{
150+
@RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
151+
;
152+
}
153+
154+
if (pa.ApmAgentNode is not null)
155+
{
156+
@RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
157+
;
158+
}
159+
160+
if (pa.ApmAgentPhp is not null)
161+
{
162+
@RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
163+
;
164+
}
165+
166+
if (pa.ApmAgentPython is not null)
167+
{
168+
@RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
169+
;
170+
}
171+
172+
if (pa.ApmAgentRuby is not null)
173+
{
174+
@RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
175+
;
176+
}
177+
178+
if (pa.ApmAgentRum is not null)
179+
{
180+
@RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
181+
;
182+
}
183+
184+
if (pa.EdotIos is not null)
185+
{
186+
@RenderProduct("EDOT iOS", "Elastic Distributions of OpenTelemetry for iOS", VersioningSystemId.EdotIos, pa.EdotIos)
187+
;
188+
}
189+
190+
if (pa.EdotAndroid is not null)
191+
{
192+
@RenderProduct("EDOT Android", "Elastic Distributions of OpenTelemetry for Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
193+
;
194+
}
195+
196+
if (pa.EdotDotnet is not null)
197+
{
198+
@RenderProduct("EDOT .NET", " Elastic Distributions of OpenTelemetry for .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
199+
;
200+
}
201+
202+
if (pa.EdotJava is not null)
203+
{
204+
@RenderProduct("EDOT Java", "Elastic Distributions of OpenTelemetry for Java", VersioningSystemId.EdotJava, pa.EdotJava)
205+
;
206+
}
207+
208+
if (pa.EdotNode is not null)
209+
{
210+
@RenderProduct("EDOT Node.js", "Elastic Distributions of OpenTelemetry for Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
211+
;
212+
}
213+
214+
if (pa.EdotPhp is not null)
215+
{
216+
@RenderProduct("EDOT PHP", "Elastic Distributions of OpenTelemetry for PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
217+
;
218+
}
219+
220+
if (pa.EdotPython is not null)
221+
{
222+
@RenderProduct("EDOT Python", "Elastic Distributions of OpenTelemetry for Python", VersioningSystemId.EdotPython, pa.EdotPython)
223+
;
224+
}
130225
}
131226

132227
@functions {
133228

134229
private IHtmlContent RenderProduct(string name, string description, VersioningSystemId versioningSystemName, AppliesCollection applications)
135230
{
136231
var versioningSystem = Model.VersionsConfig.GetVersioningSystem(versioningSystemName);
137-
232+
138233
foreach (var applicability in applications)
139234
{
140-
141235
var lifecycleTooltip = "";
142236
var badgeText = name;
143237
var lifecycleClass = applicability.GetLifeCycleName().ToLowerInvariant().Replace(" ", "-");
@@ -154,6 +248,7 @@
154248
{
155249
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.";
156250
}
251+
157252
break;
158253
case ProductLifecycle.Beta:
159254
if (TryGetRealVersion(applicability, out var betaVersion) && betaVersion > versioningSystem.Current)
@@ -191,36 +286,38 @@
191286
badgeText = "Removal planned";
192287
lifecycleTooltip = "We plan to remove this functionality in a future update. Plans may change without notice.";
193288
}
289+
194290
break;
195291
}
196292

197293
if (
198-
applicability.Version is null
199-
&& applicability.Lifecycle != ProductLifecycle.Deprecated
294+
applicability.Version is null
295+
&& applicability.Lifecycle != ProductLifecycle.Deprecated
200296
&& applicability.Lifecycle != ProductLifecycle.Removed
201297
&& versioningSystem.Id is VersioningSystemId.Stack or VersioningSystemId.Self or VersioningSystemId.Ece or VersioningSystemId.Eck
202298
)
203299
{
204300
lifecycleTooltip += $"\n\nApplies to version {versioningSystem.Base} and later - may have been introduced in a previous version";
205301
}
206-
302+
207303
var badgeTextChanged = badgeText != name;
208304
<span class="applicable-info">
209305
<span class="applicable-name" data-tippy-content="@description">@name</span>
210-
306+
211307
@{
212308
var showLifeCycle = applicability.Lifecycle != ProductLifecycle.GenerallyAvailable && !badgeTextChanged;
213309
var showVersion = applicability.Version is not null and not AllVersions;
214310
}
215-
311+
216312
@if (showLifeCycle || showVersion)
217313
{
218314
<span class="applicable-separator"></span>
219315
}
220316
<span class="applicable-meta applicable-meta-@lifecycleClass" data-tippy-content="@lifecycleTooltip">
221317
@if (showLifeCycle)
222318
{
223-
<span class="applicable-lifecycle applicable-lifecycle-@lifecycleClass">@applicability.GetLifeCycleName()</span>
319+
<span
320+
class="applicable-lifecycle applicable-lifecycle-@lifecycleClass">@applicability.GetLifeCycleName()</span>
224321
}
225322
@if (showVersion)
226323
{
@@ -238,10 +335,14 @@
238335
</span>
239336
</span>
240337
}
338+
241339
return HtmlString.Empty;
242340
}
341+
243342
}
343+
244344
@functions {
345+
245346
private static bool TryGetRealVersion(Applicability applicability, [NotNullWhen(true)] out SemVersion? version)
246347
{
247348
version = null;
@@ -253,4 +354,5 @@
253354

254355
return false;
255356
}
357+
256358
}

tests/authoring/Inline/AppliesToRole.fs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ This is an inline {applies_to}`stack: preview 9.1` element.
2929
let ``validate HTML: generates link and alt attr`` () =
3030
markdown |> convertsToHtml """
3131
<p>This is an inline
32-
<span class="applies-inline">
32+
<span class="applies applies-inline">
3333
<span class="applicable-info">
3434
<span class="applicable-name" data-tippy-content="Part of the versioned Elastic Stack
3535
36-
Available in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated">Elastic Stack</span>
36+
Available in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated">Stack</span>
37+
<span class="applicable-separator"></span>
3738
<span class="applicable-meta applicable-meta-planned" data-tippy-content="We plan to add this functionality in a future update. Plans may change without notice.">
38-
<span class="applicable-lifecycle applicable-lifecycle-planned">
39-
Planned
40-
</span>
39+
Planned
4140
</span>
4241
</span>
4342
</span>

0 commit comments

Comments
 (0)