Skip to content

Commit 2d906f5

Browse files
committed
list overloads on operationview
1 parent 2126466 commit 2d906f5

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/Elastic.ApiExplorer/Endpoints/IndexViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5+
using Elastic.ApiExplorer.Landing;
6+
57
namespace Elastic.ApiExplorer.Endpoints;
68

79
public class IndexViewModel : ApiViewModel

src/Elastic.ApiExplorer/OpenApiGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ private async Task<IFileInfo> Render<T>(INavigationItem current, T page, ApiRend
289289
var navigationHtml = await navigationRenderer.RenderNavigation(current.NavigationRoot, new Uri("http://ignored.example"), ctx);
290290
renderContext = renderContext with
291291
{
292+
CurrentNavigation = current,
292293
NavigationHtml = navigationHtml
293294
};
294295
await using var stream = _writeFileSystem.FileStream.New(outputFile.FullName, FileMode.OpenOrCreate);

src/Elastic.ApiExplorer/Operations/OperationView.cshtml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@using Elastic.ApiExplorer.Landing
12
@using Elastic.Documentation.Configuration.Assembler
23
@using Elastic.Documentation.Configuration.Builder
34
@inherits RazorSliceHttpResult<Elastic.ApiExplorer.Operations.OperationViewModel>
@@ -20,9 +21,20 @@
2021
StaticFileContentHashProvider = Model.StaticFileContentHashProvider
2122
};
2223
}
23-
24-
@if (Model.CurrentNavigationItem.)
25-
24+
@{
25+
var parent = Model.CurrentNavigationItem.Parent as EndpointNavigationItem;
26+
}
27+
@if (parent is not null && parent.NavigationItems.Count > 0 && parent.NavigationItems.All(n => n.Hidden))
28+
{
29+
<ul>
30+
@foreach (var overload in parent.NavigationItems)
31+
{
32+
<li>
33+
<a href="@overload.Url">@overload.Model.OperationType @overload.Model.Route</a>
34+
</li>
35+
}
36+
</ul>
37+
}
2638

2739
<section id="elastic-docs-v3">
2840
<h1>Id: @Model.Operation.Operation.OperationId</h1>

0 commit comments

Comments
 (0)