Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
175 changes: 89 additions & 86 deletions src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
@RenderProduct(
"Stack",
"Part of the versioned Elastic Stack\n\nAvailable in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated",
"Elastic Stack",
VersioningSystemId.Stack,
appliesTo.Stack
)
Expand All @@ -22,7 +22,7 @@
if (appliesTo.Deployment.Ece is not null)
{
@RenderProduct("ECE",
"Elastic Cloud Enterprise",
"Elastic Cloud Enterprise",
VersioningSystemId.Ece,
appliesTo.Deployment.Ece
)
Expand All @@ -32,7 +32,7 @@
{
@RenderProduct(
"ECK",
"Elastic Cloud on Kubernetes",
"Elastic Cloud on Kubernetes",
VersioningSystemId.Eck,
appliesTo.Deployment.Eck
)
Expand All @@ -42,7 +42,7 @@
{
@RenderProduct(
"ECH",
"Elastic Cloud Hosted",
"Elastic Cloud Hosted",
VersioningSystemId.Ess,
appliesTo.Deployment.Ess
)
Expand All @@ -52,7 +52,7 @@
{
@RenderProduct(
"Self-Managed",
"Self-managed Elastic deployments",
"Self-managed Elastic deployments",
VersioningSystemId.Self,
appliesTo.Deployment.Self
)
Expand All @@ -64,7 +64,7 @@
{
@RenderProduct(
"Serverless",
"Elastic Cloud Serverless: Fully-managed Elastic, available in Elastic Cloud",
"Elastic Cloud Serverless",
VersioningSystemId.Serverless,
appliesTo.Serverless.AllProjects
)
Expand All @@ -75,7 +75,7 @@
{
@RenderProduct(
"Serverless Elasticsearch",
"Serverless Elasticsearch projects",
"Serverless Elasticsearch projects",
VersioningSystemId.Elasticsearch,
appliesTo.Serverless.Elasticsearch
)
Expand All @@ -85,7 +85,7 @@
{
@RenderProduct(
"Serverless Observability",
"Serverless Observability projects",
"Serverless Observability projects",
VersioningSystemId.Observability,
appliesTo.Serverless.Observability
)
Expand All @@ -95,7 +95,7 @@
{
@RenderProduct(
"Serverless Security",
"Serverless Security projects",
"Serverless Security projects",
VersioningSystemId.Security,
appliesTo.Serverless.Security
)
Expand All @@ -111,209 +111,212 @@
var pa = appliesTo.ProductApplicability;
if (pa.Ecctl is not null)
{
@RenderProduct("ECCTL", "Elastic Cloud Control", VersioningSystemId.Ecctl, pa.Ecctl)
@RenderProduct("ECCTL", "Elastic Cloud Control", VersioningSystemId.Ecctl, pa.Ecctl)
;
}

if (pa.Curator is not null)
{
@RenderProduct("Curator", "", VersioningSystemId.Curator, pa.Curator)
@RenderProduct("Curator", "Curator", VersioningSystemId.Curator, pa.Curator)
;
}

if (pa.ApmAgentAndroid is not null)
{
@RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
@RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
;
}

if (pa.ApmAgentDotnet is not null)
{
@RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
@RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
;
}

if (pa.ApmAgentGo is not null)
{
@RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
@RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
;
}

if (pa.ApmAgentIos is not null)
{
@RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
@RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
;
}

if (pa.ApmAgentJava is not null)
{
@RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
@RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
;
}

if (pa.ApmAgentNode is not null)
{
@RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
@RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
;
}

if (pa.ApmAgentPhp is not null)
{
@RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
@RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
;
}

if (pa.ApmAgentPython is not null)
{
@RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
@RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
;
}

if (pa.ApmAgentRuby is not null)
{
@RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
@RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
;
}

if (pa.ApmAgentRum is not null)
{
@RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
@RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
;
}

if (pa.EdotIos is not null)
{
@RenderProduct("EDOT iOS", "Elastic Distributions of OpenTelemetry for iOS", VersioningSystemId.EdotIos, pa.EdotIos)
@RenderProduct("EDOT iOS", "Elastic Distributions of OpenTelemetry for iOS", VersioningSystemId.EdotIos, pa.EdotIos)
;
}

if (pa.EdotAndroid is not null)
{
@RenderProduct("EDOT Android", "Elastic Distributions of OpenTelemetry for Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
@RenderProduct("EDOT Android", "Elastic Distributions of OpenTelemetry for Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
;
}

if (pa.EdotDotnet is not null)
{
@RenderProduct("EDOT .NET", " Elastic Distributions of OpenTelemetry for .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
@RenderProduct("EDOT .NET", " Elastic Distributions of OpenTelemetry for .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
;
}

if (pa.EdotJava is not null)
{
@RenderProduct("EDOT Java", "Elastic Distributions of OpenTelemetry for Java", VersioningSystemId.EdotJava, pa.EdotJava)
@RenderProduct("EDOT Java", "Elastic Distributions of OpenTelemetry for Java", VersioningSystemId.EdotJava, pa.EdotJava)
;
}

if (pa.EdotNode is not null)
{
@RenderProduct("EDOT Node.js", "Elastic Distributions of OpenTelemetry for Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
@RenderProduct("EDOT Node.js", "Elastic Distributions of OpenTelemetry for Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
;
}

if (pa.EdotPhp is not null)
{
@RenderProduct("EDOT PHP", "Elastic Distributions of OpenTelemetry for PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
@RenderProduct("EDOT PHP", "Elastic Distributions of OpenTelemetry for PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
;
}

if (pa.EdotPython is not null)
{
@RenderProduct("EDOT Python", "Elastic Distributions of OpenTelemetry for Python", VersioningSystemId.EdotPython, pa.EdotPython)
@RenderProduct("EDOT Python", "Elastic Distributions of OpenTelemetry for Python", VersioningSystemId.EdotPython, pa.EdotPython)
;
}
}

@functions {

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

foreach (var applicability in applications)
{
var lifecycleTooltip = "";
var badgeText = name;
var badgeText = key;
var tooltipText = "";
var lifecycleClass = applicability.GetLifeCycleName().ToLowerInvariant().Replace(" ", "-");
switch (applicability.Lifecycle)

var lifecycleFull = applicability.Lifecycle switch
{
ProductLifecycle.GenerallyAvailable => "Available",
ProductLifecycle.Beta => "Available in beta",
ProductLifecycle.TechnicalPreview => "Available in technical preview",
ProductLifecycle.Deprecated => "Deprecated",
ProductLifecycle.Removed => "Removed",
_ => ""
};

var realVersion = TryGetRealVersion(applicability, out var v) ? v : null;

if (realVersion is not null)
{
case ProductLifecycle.TechnicalPreview:
if (TryGetRealVersion(applicability, out var previewVersion) && previewVersion > versioningSystem.Current)
{
badgeText = "Planned";
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
lifecycleClass = "planned";
}
else
{
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.";
}

break;
case ProductLifecycle.Beta:
if (TryGetRealVersion(applicability, out var betaVersion) && betaVersion > versioningSystem.Current)
{
badgeText = "Planned";
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
lifecycleClass = "planned";
}
else
if (realVersion <= versioningSystem.Current)
{
tooltipText = $"{lifecycleFull} in {keyFull} in version {realVersion} and later unless otherwise specified.";
}
else
{
if (applicability.Lifecycle is ProductLifecycle.GenerallyAvailable or ProductLifecycle.Beta or ProductLifecycle.TechnicalPreview)
{
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.";
tooltipText = $"We plan to add this in a future {keyFull} update. Plans may change without notice.";
}

break;
case ProductLifecycle.GenerallyAvailable:
if (TryGetRealVersion(applicability, out var version) && version > versioningSystem.Current)
else if (applicability.Lifecycle is ProductLifecycle.Deprecated)
{
badgeText = "Planned";
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
lifecycleClass = "planned";
tooltipText = $"We plan to deprecate this in a future {keyFull} update. Plans may change without notice.";
}

break;
case ProductLifecycle.Deprecated:
if (TryGetRealVersion(applicability, out var deprecatedVersion) && deprecatedVersion > versioningSystem.Current)
else if (applicability.Lifecycle is ProductLifecycle.Removed)
{
badgeText = "Deprecation planned";
lifecycleTooltip = "We plan to deprecate this functionality in a future update. Plans may change without notice.";
tooltipText = $"We plan to remove this in a future {keyFull} update. Plans may change without notice.";
}
}

}
else
{
tooltipText = $"{lifecycleFull} in {keyFull} unless otherwise specified.";
}

break;
case ProductLifecycle.Removed:
if (TryGetRealVersion(applicability, out var removedVersion) && removedVersion > versioningSystem.Current)
{
badgeText = "Removal planned";
lifecycleTooltip = "We plan to remove this functionality in a future update. Plans may change without notice.";
}
var disclaimer = applicability.Lifecycle switch
{
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.",
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.",
ProductLifecycle.GenerallyAvailable => versioningSystem.Id is VersioningSystemId.Stack ? "Available in ECH, ECE, ECK, and self-managed deployments, unless otherwise specified." : null,
_ => null
};

break;
if (disclaimer is not null)
{
tooltipText = $"{tooltipText}\n\n{disclaimer}";
}

if (
applicability.Version is null
&& applicability.Lifecycle != ProductLifecycle.Deprecated
&& applicability.Lifecycle != ProductLifecycle.Removed
&& versioningSystem.Id is VersioningSystemId.Stack or VersioningSystemId.Self or VersioningSystemId.Ece or VersioningSystemId.Eck
)
if (realVersion is not null && realVersion > versioningSystem.Current)
{
lifecycleTooltip += $"\n\nApplies to version {versioningSystem.Base} and later - may have been introduced in a previous version";
badgeText = applicability.Lifecycle switch
{
ProductLifecycle.TechnicalPreview => "Planned",
ProductLifecycle.Beta => "Planned",
ProductLifecycle.GenerallyAvailable => "Planned",
ProductLifecycle.Deprecated => "Deprecation planned",
ProductLifecycle.Removed => "Removal planned",
_ => badgeText
};
}

var badgeTextChanged = badgeText != name;
<span class="applicable-info">
<span class="applicable-name" data-tippy-content="@description">@name</span>
var badgeTextChanged = badgeText != key;
<span class="applicable-info" data-tippy-content="@(new HtmlString(tooltipText))">
<span class="applicable-name">@key</span>

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

@if (!string.IsNullOrEmpty(name) && (showLifeCycle || showVersion))
@if (!string.IsNullOrEmpty(key) && (showLifeCycle || showVersion))
{
<span class="applicable-separator"></span>
}
<span class="applicable-meta applicable-meta-@lifecycleClass" data-tippy-content="@lifecycleTooltip">
<span class="applicable-meta applicable-meta-@lifecycleClass">
@if (showLifeCycle)
{
<span
Expand Down
8 changes: 4 additions & 4 deletions tests/authoring/Inline/AppliesToRole.fs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ This is an inline {applies_to}`stack: preview 9.1` element.
markdown |> convertsToHtml """
<p>This is an inline
<span class="applies applies-inline">
<span class="applicable-info">
<span class="applicable-name" data-tippy-content="Part of the versioned Elastic Stack
<span class="applicable-info" data-tippy-content="We plan to add this in a future Elastic&nbsp;Stack update. Plans may change without notice.

Available in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated">Stack</span>
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.">
<span class="applicable-name">Stack</span>
<span class="applicable-separator"></span>
<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.">
<span class="applicable-meta applicable-meta-preview">
Planned
</span>
</span>
Expand Down
Loading