Skip to content

Commit c009829

Browse files
committed
Add new version dropdown feature flag and enhance existing dropdown
1 parent 7fba666 commit c009829

File tree

25 files changed

+2970
-359
lines changed

25 files changed

+2970
-359
lines changed

src/Elastic.ApiExplorer/Endpoints/EndpointView.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
Previous = null,
1414
Next = null,
1515
NavigationHtml = Model.NavigationHtml,
16-
LegacyPage = null,
16+
LegacyPages = [],
17+
CurrentVersion = null,
18+
VersionDropdown = null,
1719
UrlPathPrefix = null,
1820
GithubEditUrl = null,
1921
ReportIssueUrl = null,

src/Elastic.ApiExplorer/Landing/LandingView.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
Previous = null,
1414
Next = null,
1515
NavigationHtml = Model.NavigationHtml,
16-
LegacyPage = null,
16+
LegacyPages = [],
17+
CurrentVersion = null,
18+
VersionDropdown = null,
1719
UrlPathPrefix = null,
1820
GithubEditUrl = null,
1921
ReportIssueUrl = null,

src/Elastic.ApiExplorer/Operations/OperationView.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
Previous = null,
1414
Next = null,
1515
NavigationHtml = Model.NavigationHtml,
16-
LegacyPage = null,
16+
LegacyPages = [],
17+
VersionDropdown = null,
18+
CurrentVersion = null,
1719
UrlPathPrefix = null,
1820
GithubEditUrl = null,
1921
ReportIssueUrl = null,

src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ private static TRepository RepositoryDefaults<TRepository>(TRepository r, string
6767
return repository;
6868
}
6969

70+
[YamlMember(Alias = "versions")]
71+
public Dictionary<string, VersionEntry> Versions { get; set; } = [];
72+
7073
[YamlMember(Alias = "narrative")]
7174
public NarrativeRepository Narrative { get; set; } = new();
7275

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
using YamlDotNet.Serialization;
6+
7+
namespace Elastic.Documentation.Configuration.Assembler;
8+
9+
public record VersionEntry
10+
{
11+
[YamlMember(Alias = "base")]
12+
public string? Base { get; set; }
13+
14+
[YamlMember(Alias = "current")]
15+
public string? Current { get; set; }
16+
17+
[YamlMember(Alias = "legacy_versions")]
18+
public IReadOnlyList<string> LegacyVersions { get; set; } = [];
19+
}

src/Elastic.Documentation.Configuration/Builder/FeatureFlags.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Elastic.Documentation.Configuration.Builder;
77
public class FeatureFlags(Dictionary<string, bool> featureFlags)
88
{
99
public bool IsPrimaryNavEnabled => IsEnabled("primary-nav");
10-
public bool IsLandingPageEnabled => IsEnabled("landing-page");
10+
public bool IsVersionDropdownEnabled => IsEnabled("version-dropdown");
1111
private bool IsEnabled(string key)
1212
{
1313
var envKey = $"FEATURE_{key.ToUpperInvariant().Replace('-', '_')}";

src/Elastic.Documentation.Configuration/Builder/Products.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,24 @@
66

77
namespace Elastic.Documentation.Configuration.Builder;
88

9-
public record Product(string Id, string DisplayName);
9+
public record Product(string Id, string DisplayName, HashSet<Product>? SubProduct = null);
1010

1111
public static class Products
1212
{
1313
public static FrozenSet<Product> All { get; } = [
1414
new("apm", "APM"),
15-
new("apm-agent", "APM Agent"),
15+
new("apm-agent", "APM Agent", [
16+
new Product("apm-agent-android", "APM Android Agent"),
17+
new Product("apm-agent-dotnet", "APM .NET Agent"),
18+
new Product("apm-agent-go", "APM Go Agent"),
19+
new Product("apm-agent-java", "APM Java Agent"),
20+
new Product("apm-agent-nodejs", "APM Node.js Agent"),
21+
new Product("apm-agent-php", "APM PHP Agent"),
22+
new Product("apm-agent-python", "APM Python Agent"),
23+
new Product("apm-agent-ruby", "APM Ruby Agent"),
24+
new Product("apm-agent-rum-js", "APM RUM JS Agent"),
25+
new Product("apm-agent-ios", "APM RUM React Agent"),
26+
]),
1627
new("auditbeat", "Auditbeat"),
1728
new("beats", "Beats"),
1829
new("cloud-control-ecctl", "Elastic Cloud Control ECCTL"),

src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ namespace Elastic.Documentation.Configuration.Serialization;
1414
[YamlSerializable(typeof(PublishEnvironment))]
1515
[YamlSerializable(typeof(GoogleTagManager))]
1616
[YamlSerializable(typeof(ContentSource))]
17+
[YamlSerializable(typeof(VersionEntry))]
1718
public partial class YamlStaticContext;

src/Elastic.Documentation.Site/Assets/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'htmx-ext-preload'
1111
import 'htmx.org'
1212
import { $, $$ } from 'select-dom'
1313
import { UAParser } from 'ua-parser-js'
14+
import './web-components/VersionDropdown'
1415

1516
const { getOS } = new UAParser()
1617

0 commit comments

Comments
 (0)