11@using Elastic .ApiExplorer .Landing
2+ @using Elastic .ApiExplorer .Operations
23@using Elastic .Documentation .Configuration .Assembler
34@using Elastic .Documentation .Configuration .Builder
5+ @using Microsoft .OpenApi .Models
46@inherits RazorSliceHttpResult <Elastic .ApiExplorer .Operations .OperationViewModel >
57@implements IUsesLayout <Elastic .ApiExplorer ._Layout , GlobalLayoutViewModel >
68@functions {
2325}
2426@{
2527 var parent = Model .CurrentNavigationItem .Parent as EndpointNavigationItem ;
28+ var self = Model .CurrentNavigationItem as OperationNavigationItem ;
29+ var allOperations =
30+ parent is not null && parent .NavigationItems .Count > 0 && parent .NavigationItems .All (n => n .Hidden )
31+ ? parent .NavigationItems
32+ : self is not null
33+ ? [self ]
34+ : [];
35+
36+ var operation = Model .Operation .Operation ;
2637}
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 )
38+
39+ <div class =" w-full h-full grid
40+ grid-cols-1
41+ md:grid-cols-[1fr_var(--max-examples-width)]
42+ lg:grid-cols-[1fr_var(--max-examples-width)]
43+ " >
44+ <section id =" elastic-api-v3" >
45+ <h1 >@operation.Summary </h1 >
46+ <p >
47+ @operation.Description
48+ </p >
49+ <ul class =" api-url-listing" >
50+ @foreach ( var overload in allOperations )
51+ {
52+ var method = overload .Model .OperationType .ToString ().ToLowerInvariant ();
53+ var current = overload .Model .Route == Model .Operation .Route && overload .Model .OperationType == Model .Operation .OperationType ? " current" : " " ;
54+ <li class =" api-url-list-item" >
55+ <a href =" @overload.Url" class =" @current" >
56+ <span class =" api-method api-method-@method" >@method.ToUpperInvariant() </span >
57+ <span class =" api-url" >@overload.Model.Route </span >
58+ </a >
59+ </li >
60+ }
61+ </ul >
62+ @{
63+ var pathParameters = operation .Parameters ? .Where (p => p .In == ParameterLocation .Path ).ToArray () ?? [];
64+ }
65+ @if (pathParameters .Length > 0 )
3166 {
32- <li >
33- <a href =" @overload.Url" >@overload.Model.OperationType @overload.Model.Route </a >
34- </li >
67+ <h3 >Path Parameters </h3 >
68+ <dl >
69+ @foreach ( var path in pathParameters )
70+ {
71+ <dt id =" @path.Name" ><a href =" #@path.Name" ><code >@path.Name </code ></a ></dt >
72+ <dd >@path.Description </dd >
73+ }
74+ </dl >
75+ }
76+ @{
77+ var queryStringParameters = operation .Parameters ? .Where (p => p .In == ParameterLocation .Query ).ToArray () ?? [];
78+ }
79+ @if (queryStringParameters .Length > 0 )
80+ {
81+ <h3 >Query String Parameters </h3 >
82+ <dl >
83+ @foreach ( var path in queryStringParameters )
84+ {
85+ <dt id =" @path.Name" ><a href =" #@path.Name" ><code >@path.Name </code ></a ></dt >
86+ <dd >@path.Description </dd >
87+ }
88+ </dl >
3589 }
36- </ul >
37- }
38-
39- <section id =" elastic-docs-v3" >
40- <h1 >Id: @Model.Operation.Operation.OperationId </h1 >
41- <h2 >Name: @Model.Operation.ApiName </h2 >
42- <h2 >Url: @Model.Operation.OperationType.ToString() @Model.Operation.Route </h2 >
4390</section >
91+ <aside >
92+
93+ </aside >
94+ </div >
0 commit comments