Skip to content

Commit b999745

Browse files
committed
Fix merge conflicts
1 parent 5df98f2 commit b999745

File tree

12 files changed

+26
-17
lines changed

12 files changed

+26
-17
lines changed

src/Elastic.ApiExplorer/Endpoints/EndpointView.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Next = null,
1313
NavigationHtml = Model.NavigationHtml,
1414
UrlPathPrefix = null,
15+
VersionDropdown = null,
1516
AllowIndexing = false,
1617
CanonicalBaseUrl = null,
1718
GoogleTagManager = new GoogleTagManagerConfiguration(),

src/Elastic.ApiExplorer/Landing/LandingView.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Next = null,
1313
NavigationHtml = Model.NavigationHtml,
1414
UrlPathPrefix = null,
15+
VersionDropdown = null,
1516
AllowIndexing = false,
1617
CanonicalBaseUrl = null,
1718
GoogleTagManager = new GoogleTagManagerConfiguration(),

src/Elastic.ApiExplorer/Operations/OperationView.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Next = null,
1313
NavigationHtml = Model.NavigationHtml,
1414
UrlPathPrefix = null,
15+
VersionDropdown = null,
1516
AllowIndexing = false,
1617
CanonicalBaseUrl = null,
1718
GoogleTagManager = new GoogleTagManagerConfiguration(),

src/Elastic.Documentation.Site/Layout/_SecondaryNav.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
<a href="@Model.Link("/")" class="text-lg leading-[1em] hover:text-blue-elastic active:text-blue-elastic-100">Docs</a>
1616

17-
@if (Model.Features.IsVersionDropdownEnabled)
17+
@if (Model.Features.IsVersionDropdownEnabled && Model.VersionDropdown is not null)
1818
{
1919
<div id="version-dropdown">
2020
<version-dropdown items='@(new HtmlString(Model.VersionDropdown))' />

src/Elastic.Documentation.Site/_ViewModels.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ public class GlobalLayoutViewModel
2525
public required INavigationItem? Previous { get; init; }
2626
public required INavigationItem? Next { get; init; }
2727

28+
public required string? VersionDropdown { get; init; }
29+
2830
public required string NavigationHtml { get; init; }
2931
public required string? UrlPathPrefix { get; init; }
3032
public required Uri? CanonicalBaseUrl { get; init; }
3133
public string? CanonicalUrl => CanonicalBaseUrl is not null ?
3234
new Uri(CanonicalBaseUrl, CurrentNavigationItem?.Url).ToString().TrimEnd('/') : null;
3335

3436
public required FeatureFlags Features { get; init; }
35-
3637
// TODO move to @inject
3738
public required GoogleTagManagerConfiguration GoogleTagManager { get; init; }
3839
public required bool AllowIndexing { get; init; }

src/Elastic.Documentation/Legacy/ILegacyUrlMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ public interface ILegacyUrlMapper
1616

1717
public record NoopLegacyUrlMapper : ILegacyUrlMapper
1818
{
19-
public List<LegacyPageMapping> MapLegacyUrl(IReadOnlyCollection<string>? mappedPages) => [];
19+
public IReadOnlyCollection<LegacyPageMapping> MapLegacyUrl(IReadOnlyCollection<string>? mappedPages) => [];
2020
}

src/Elastic.Markdown/Slices/HtmlWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ private async Task<string> RenderLayout(MarkdownFile markdown, MarkdownDocument
110110
Features = DocumentationSet.Configuration.Features,
111111
StaticFileContentHashProvider = StaticFileContentHashProvider,
112112
ReportIssueUrl = reportUrl,
113-
CurrentVersion = legacyPages.Count > 0 ? legacyPages[0].Version : "9.0+",
114-
LegacyPages = legacyPages.Count > 1 ? [legacyPages[1]] : [],
113+
CurrentVersion = legacyPages.Count > 0 ? legacyPages.ElementAt(0).Version : "9.0+",
114+
LegacyPages = legacyPages.Count > 1 ? [legacyPages.ElementAt(1)] : [],
115115
VersionDropdownItems = VersionDrownDownItemViewModel.FromLegacyPageMappings(legacyPages.Skip(1).ToArray()),
116116
Products = allProducts
117117
});

src/Elastic.Markdown/Slices/Index.cshtml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
DocSetName = Model.DocSetName,
1212
Title = $"{Model.Title} | {Model.SiteName}",
1313
Description = Model.Description,
14-
PageTocItems = Model.PageTocItems.Where(i => i is { Level: 2 or 3 }).ToList(),
14+
PageTocItems = Model.PageTocItems.Where(i => i is
15+
{
16+
Level: 2 or 3
17+
})
18+
.ToList(),
1519
CurrentNavigationItem = Model.CurrentNavigationItem,
1620
Previous = Model.PreviousDocument,
1721
Next = Model.NextDocument,
@@ -27,8 +31,8 @@
2731
ReportIssueUrl = Model.ReportIssueUrl,
2832
LegacyPages = Model.LegacyPages,
2933
CurrentVersion = Model.CurrentVersion,
30-
VersionDropdown = JsonSerializer.Serialize(Model.VersionDropdownItems, ViewModelSerializerContext.Default.VersionDrownDownItemViewModelArray),
31-
Products = Model.Products is { Count: > 0} products ? string.Join(",", products.Select(p => p.DisplayName)) : null,
34+
VersionDropdown = JsonSerializer.Serialize(Model.VersionDropdownItems,
35+
ViewModelSerializerContext.Default.VersionDrownDownItemViewModelArray),
3236
};
3337
protected override Task ExecuteSectionAsync(string name)
3438
{

src/Elastic.Markdown/Slices/MarkdownLayoutViewModel.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public class MarkdownLayoutViewModel : GlobalLayoutViewModel
1616

1717
public required INavigationItem[] Parents { get; init; }
1818

19-
public required LegacyPageMapping? LegacyPage { get; init; }
19+
public required string? CurrentVersion { get; init; }
20+
21+
public required LegacyPageMapping[] LegacyPages { get; init; }
2022

2123
public required IReadOnlyCollection<PageTocItem> PageTocItems { get; init; }
2224

@@ -29,4 +31,3 @@ public record PageTocItem
2931
public required string Slug { get; init; }
3032
public required int Level { get; init; }
3133
}
32-

src/tooling/docs-assembler/AssembleSources.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ private AssembleSources(ILoggerFactory logger, AssembleContext assembleContext,
109109
.ToFrozenDictionary();
110110
}
111111

112-
private static FrozenDictionary<string, List<string>> GetHistoryMapping(AssembleContext context)
112+
private static FrozenDictionary<string, IReadOnlyCollection<string>> GetHistoryMapping(AssembleContext context)
113113
{
114-
var dictionary = new Dictionary<string, List<string>>();
114+
var dictionary = new Dictionary<string, IReadOnlyCollection<string>>();
115115
var reader = new YamlStreamReader(context.HistoryMappingPath, context.Collector);
116116
string? stack = null;
117117
foreach (var entry in reader.Read())
@@ -126,7 +126,7 @@ private static FrozenDictionary<string, List<string>> GetHistoryMapping(Assemble
126126

127127
return dictionary.OrderByDescending(x => x.Key.Length).ToFrozenDictionary();
128128

129-
static void ReadHistoryMappings(IDictionary<string, List<string>> dictionary, YamlStreamReader reader, YamlToplevelKey entry, string? newStack)
129+
static void ReadHistoryMappings(IDictionary<string, IReadOnlyCollection<string>> dictionary, YamlStreamReader reader, YamlToplevelKey entry, string? newStack)
130130
{
131131
if (entry.Entry.Value is not YamlMappingNode mappings)
132132
{

0 commit comments

Comments
 (0)