Skip to content

Commit ac79766

Browse files
committed
wip
1 parent 19a288c commit ac79766

File tree

2 files changed

+186
-342
lines changed

2 files changed

+186
-342
lines changed
Lines changed: 17 additions & 342 deletions
Original file line numberDiff line numberDiff line change
@@ -1,357 +1,32 @@
1-
@using System.Diagnostics.CodeAnalysis
2-
@using Elastic.Documentation
3-
@using Elastic.Documentation.AppliesTo
4-
@using Elastic.Documentation.Configuration.Versions
51
@inherits RazorSlice<Elastic.Markdown.Myst.Components.ApplicableToViewModel>
62

7-
@{
8-
var appliesTo = Model.AppliesTo;
9-
}
10-
11-
@if (appliesTo.Stack is not null)
12-
{
13-
@RenderProduct(
14-
"Stack",
15-
"Elastic&nbsp;Stack",
16-
VersioningSystemId.Stack,
17-
appliesTo.Stack
18-
)
19-
}
20-
@if (appliesTo.Serverless is not null)
21-
{
22-
if (appliesTo.Serverless.AllProjects is not null)
23-
{
24-
@RenderProduct(
25-
"Serverless",
26-
"Elastic&nbsp;Cloud&nbsp;Serverless",
27-
VersioningSystemId.Serverless,
28-
appliesTo.Serverless.AllProjects
29-
)
30-
}
31-
else
32-
{
33-
if (appliesTo.Serverless.Elasticsearch is not null)
34-
{
35-
@RenderProduct(
36-
"Serverless Elasticsearch",
37-
"Serverless&nbsp;Elasticsearch projects",
38-
VersioningSystemId.ElasticsearchProject,
39-
appliesTo.Serverless.Elasticsearch
40-
)
41-
}
42-
43-
if (appliesTo.Serverless.Observability is not null)
44-
{
45-
@RenderProduct(
46-
"Serverless Observability",
47-
"Serverless&nbsp;Observability projects",
48-
VersioningSystemId.ObservabilityProject,
49-
appliesTo.Serverless.Observability
50-
)
51-
}
52-
53-
if (appliesTo.Serverless.Security is not null)
54-
{
55-
@RenderProduct(
56-
"Serverless Security",
57-
"Serverless&nbsp;Security projects",
58-
VersioningSystemId.SecurityProject,
59-
appliesTo.Serverless.Security
60-
)
61-
}
62-
}
63-
}
64-
@if (appliesTo.Deployment is not null)
65-
{
66-
67-
if (appliesTo.Deployment.Ess is not null)
68-
{
69-
@RenderProduct(
70-
"ECH",
71-
"Elastic&nbsp;Cloud&nbsp;Hosted",
72-
VersioningSystemId.Ess,
73-
appliesTo.Deployment.Ess
74-
)
75-
}
76-
77-
if (appliesTo.Deployment.Eck is not null)
78-
{
79-
@RenderProduct(
80-
"ECK",
81-
"Elastic&nbsp;Cloud&nbsp;on&nbsp;Kubernetes",
82-
VersioningSystemId.Eck,
83-
appliesTo.Deployment.Eck
84-
)
85-
}
86-
87-
if (appliesTo.Deployment.Ece is not null)
88-
{
89-
@RenderProduct("ECE",
90-
"Elastic&nbsp;Cloud&nbsp;Enterprise",
91-
VersioningSystemId.Ece,
92-
appliesTo.Deployment.Ece
93-
)
94-
}
95-
96-
if (appliesTo.Deployment.Self is not null)
97-
{
98-
@RenderProduct(
99-
"Self-Managed",
100-
"Self-managed Elastic&nbsp;deployments",
101-
VersioningSystemId.Self,
102-
appliesTo.Deployment.Self
103-
)
104-
}
105-
}
106-
@if (appliesTo.ProductApplicability is not null)
107-
{
108-
var pa = appliesTo.ProductApplicability;
109-
if (pa.Ecctl is not null)
110-
{
111-
@RenderProduct("ECCTL", "Elastic&nbsp;Cloud&nbsp;Control", VersioningSystemId.Ecctl, pa.Ecctl)
112-
}
113-
114-
if (pa.Curator is not null)
115-
{
116-
@RenderProduct("Curator", "Curator", VersioningSystemId.Curator, pa.Curator)
117-
}
118-
119-
if (pa.EdotAndroid is not null)
120-
{
121-
@RenderProduct("EDOT Android", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
122-
}
123-
124-
if (pa.EdotCfAws is not null)
125-
{
126-
@RenderProduct("EDOT CF AWS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Cloud&nbsp;Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
127-
}
128-
129-
if (pa.EdotCollector is not null)
130-
{
131-
@RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector)
132-
}
133-
134-
if (pa.EdotDotnet is not null)
135-
{
136-
@RenderProduct("EDOT .NET", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;.NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
137-
}
138-
139-
if (pa.EdotIos is not null)
140-
{
141-
@RenderProduct("EDOT iOS", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;iOS", VersioningSystemId.EdotIos, pa.EdotIos)
142-
}
143-
144-
if (pa.EdotJava is not null)
145-
{
146-
@RenderProduct("EDOT Java", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Java", VersioningSystemId.EdotJava, pa.EdotJava)
147-
}
148-
149-
if (pa.EdotNode is not null)
150-
{
151-
@RenderProduct("EDOT Node.js", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
152-
}
153-
154-
if (pa.EdotPhp is not null)
155-
{
156-
@RenderProduct("EDOT PHP", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
157-
}
158-
159-
if (pa.EdotPython is not null)
160-
{
161-
@RenderProduct("EDOT Python", "Elastic&nbsp;Distribution of OpenTelemetry&nbsp;Python", VersioningSystemId.EdotPython, pa.EdotPython)
162-
}
163-
164-
if (pa.ApmAgentAndroid is not null)
165-
{
166-
@RenderProduct("APM Agent Android", "Application&nbsp;Performance&nbsp;Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
167-
}
168-
169-
if (pa.ApmAgentDotnet is not null)
170-
{
171-
@RenderProduct("APM Agent .NET", "Application&nbsp;Performance&nbsp;Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
172-
}
173-
174-
if (pa.ApmAgentGo is not null)
175-
{
176-
@RenderProduct("APM Agent Go", "Application&nbsp;Performance&nbsp;Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
177-
}
178-
179-
if (pa.ApmAgentIos is not null)
180-
{
181-
@RenderProduct("APM Agent iOS", "Application&nbsp;Performance&nbsp;Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
182-
}
183-
184-
if (pa.ApmAgentJava is not null)
185-
{
186-
@RenderProduct("APM Agent Java", "Application&nbsp;Performance&nbsp;Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
187-
}
188-
189-
if (pa.ApmAgentNode is not null)
190-
{
191-
@RenderProduct("APM Agent Node.js", "Application&nbsp;Performance&nbsp;Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
192-
}
193-
194-
if (pa.ApmAgentPhp is not null)
195-
{
196-
@RenderProduct("APM Agent PHP", "Application&nbsp;Performance&nbsp;Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
197-
}
198-
199-
if (pa.ApmAgentPython is not null)
200-
{
201-
@RenderProduct("APM Agent Python", "Application&nbsp;Performance&nbsp;Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
202-
}
203-
204-
if (pa.ApmAgentRuby is not null)
205-
{
206-
@RenderProduct("APM Agent Ruby", "Application&nbsp;Performance&nbsp;Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
207-
}
208-
209-
if (pa.ApmAgentRum is not null)
210-
{
211-
@RenderProduct("APM Agent RUM", "Application&nbsp;Performance&nbsp;Monitoring Agent for Real&nbsp;User&nbsp;Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
212-
}
213-
}
214-
@if (appliesTo.Product is not null)
3+
@foreach (var item in Model.GetApplicabilityItems())
2154
{
216-
@RenderProduct("", "", VersioningSystemId.All, appliesTo.Product)
217-
}
218-
219-
@functions {
220-
221-
private IHtmlContent RenderProduct(string key, string keyFull, VersioningSystemId versioningSystemName, AppliesCollection applications)
222-
{
223-
var versioningSystem = Model.VersionsConfig.GetVersioningSystem(versioningSystemName);
224-
225-
foreach (var applicability in applications)
226-
{
227-
var badgeText = key;
228-
var tooltipText = "";
229-
var lifecycleClass = applicability.GetLifeCycleName().ToLowerInvariant().Replace(" ", "-");
5+
<span class="applicable-info" data-tippy-content="@(new HtmlString(item.RenderData.TooltipText))">
6+
<span class="applicable-name">@item.Key</span>
2307

231-
var lifecycleFull = applicability.Lifecycle switch
232-
{
233-
ProductLifecycle.GenerallyAvailable => "Available",
234-
ProductLifecycle.Beta => "Available in beta",
235-
ProductLifecycle.TechnicalPreview => "Available in technical preview",
236-
ProductLifecycle.Deprecated => "Deprecated",
237-
ProductLifecycle.Removed => "Removed",
238-
ProductLifecycle.Unavailable => "Not available",
239-
_ => ""
240-
};
241-
242-
var realVersion = TryGetRealVersion(applicability, out var v) ? v : null;
243-
244-
if (realVersion is not null)
245-
{
246-
247-
if (realVersion <= versioningSystem.Current)
248-
{
249-
tooltipText = $"{lifecycleFull} on {keyFull} version {realVersion} and later unless otherwise specified.";
250-
}
251-
else
252-
{
253-
tooltipText = applicability.Lifecycle switch
254-
{
255-
ProductLifecycle.GenerallyAvailable
256-
or ProductLifecycle.Beta
257-
or ProductLifecycle.TechnicalPreview
258-
or ProductLifecycle.Planned =>
259-
$"We plan to add this functionality in a future {keyFull} update. Subject to change.",
260-
ProductLifecycle.Deprecated => $"We plan to deprecate this functionality in a future {keyFull} update. Subject to change.",
261-
ProductLifecycle.Removed => $"We plan to remove this functionality in a future {keyFull} update. Subject to change.",
262-
_ => tooltipText
263-
};
264-
}
265-
266-
}
267-
else
8+
@if (!string.IsNullOrEmpty(item.Key) && (item.RenderData.ShowLifecycle || item.RenderData.ShowVersion))
2689
{
269-
tooltipText = $"{lifecycleFull} on {keyFull} unless otherwise specified.";
10+
<span class="applicable-separator"></span>
27011
}
271-
272-
var disclaimer = applicability.Lifecycle switch
273-
{
274-
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.",
275-
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.",
276-
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,
277-
_ => null
278-
};
279-
280-
if (disclaimer is not null)
281-
{
282-
tooltipText = $"{tooltipText}\n\n{disclaimer}";
283-
}
284-
285-
if (realVersion is not null && realVersion > versioningSystem.Current)
286-
{
287-
badgeText = applicability.Lifecycle switch
12+
<span class="applicable-meta [email protected]">
13+
@if (item.RenderData.ShowLifecycle)
28814
{
289-
ProductLifecycle.TechnicalPreview => "Planned",
290-
ProductLifecycle.Beta => "Planned",
291-
ProductLifecycle.GenerallyAvailable =>
292-
applications.Any(a => a.Lifecycle is ProductLifecycle.TechnicalPreview or ProductLifecycle.Beta)
293-
? "GA planned"
294-
: "Planned",
295-
ProductLifecycle.Deprecated => "Deprecation planned",
296-
ProductLifecycle.Removed => "Removal planned",
297-
ProductLifecycle.Planned => "Planned",
298-
_ => badgeText
299-
};
300-
}
301-
302-
var badgeTextChanged = badgeText != key;
303-
<span class="applicable-info" data-tippy-content="@(new HtmlString(tooltipText))">
304-
<span class="applicable-name">@key</span>
305-
306-
@{
307-
var showLifeCycle = applicability.Lifecycle != ProductLifecycle.GenerallyAvailable && !badgeTextChanged;
308-
var showVersion = applicability.Version is not null and not AllVersions;
15+
<span class="applicable-lifecycle [email protected]">@item.Applicability.GetLifeCycleName()</span>
30916
}
310-
311-
@if (!string.IsNullOrEmpty(key) && (showLifeCycle || showVersion))
17+
@if (item.RenderData.ShowVersion)
31218
{
313-
<span class="applicable-separator"></span>
314-
}
315-
<span class="applicable-meta applicable-meta-@lifecycleClass">
316-
@if (showLifeCycle)
19+
@if (item.RenderData.ShowVersion && item.RenderData.Version != item.RenderData.BadgeText)
31720
{
318-
<span
319-
class="applicable-lifecycle applicable-lifecycle-@lifecycleClass">@applicability.GetLifeCycleName()</span>
21+
<span class="applicable-version [email protected]">
22+
@item.Applicability.Version
23+
</span>
32024
}
321-
@if (showVersion)
25+
else
32226
{
323-
@if (versioningSystem.Current >= applicability.Version!)
324-
{
325-
<span class="applicable-version applicable-version-@lifecycleClass">
326-
@applicability.Version
327-
</span>
328-
}
329-
else
330-
{
331-
@badgeText
332-
}
27+
@item.RenderData.BadgeText
33328
}
334-
</span>
29+
}
33530
</span>
336-
}
337-
338-
return HtmlString.Empty;
339-
}
340-
341-
}
342-
343-
@functions {
344-
345-
private static bool TryGetRealVersion(Applicability applicability, [NotNullWhen(true)] out SemVersion? version)
346-
{
347-
version = null;
348-
if (applicability.Version is not null && applicability.Version != AllVersions.Instance)
349-
{
350-
version = applicability.Version;
351-
return true;
352-
}
353-
354-
return false;
355-
}
356-
31+
</span>
35732
}

0 commit comments

Comments
 (0)