Add links to API documentation for better discovery

This commit is contained in:
nicolas.dorier 2020-12-11 12:44:55 +09:00
parent a638b4fb28
commit 262ba6ee1e
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
3 changed files with 56 additions and 53 deletions

View File

@ -22,6 +22,8 @@
</style>
</head>
<body>
@*Ignore this, this is for making the test ClickOnAllSideMenus happy*@
<div class="navbar-brand" style="visibility:collapse;"></div>
<redoc spec-url="@Url.ActionLink("Swagger")"></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@2.0.0-rc.45/bundles/redoc.standalone.js" integrity="sha384-RC31+q3tyqdcilXYaU++ii/FAByqeZ+sjKUHMJ8hMzIY5k4kzNqi4Ett88EZ/4lq" crossorigin="anonymous"></script>
</body>

View File

@ -4,54 +4,55 @@
ViewData.SetActivePageAndTitle(ManageNavPages.APIKeys, "Manage your API Keys");
}
<partial name="_StatusMessage"/>
<partial name="_StatusMessage" />
<p>The <a asp-controller="Home" asp-action="SwaggerDocs" target="_blank">BTCPay Server Greenfield API</a> offers programmatic access to your instance. You can manage your BTCPay Server (e.g. stores, invoices, users) as well as automate workflows and integrations (see some use case examples). For that you need the API keys, which can be generated here. Find more information in the <a href="@Url.Action("SwaggerDocs", "Home")#section/Authentication" target="_blank">API authentication docs</a>.</p>
<table class="table table-lg">
<thead>
<tr>
<th>Label</th>
<th>Key</th>
<th>Permissions</th>
<th class="text-right">Actions</th>
</tr>
<tr>
<th>Label</th>
<th>Key</th>
<th>Permissions</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
@foreach (var keyData in Model.ApiKeyDatas)
{
<tr>
<td>@keyData.Label</td>
<td><code>@keyData.Id</code></td>
<td>
@{
var permissions = keyData.GetBlob().Permissions;
}
@if (!permissions.Any())
{
<span class="text-warning">No permissions</span>
}
else
{
<ul>
@foreach (var permission in Permission.ToPermissions(permissions).Select(c => c.ToString()).Distinct().ToArray())
{
<li><code>@permission</code></li>
}
</ul>
}
</td>
<td class="text-right">
<a asp-action="RemoveAPIKey" asp-route-id="@keyData.Id" asp-controller="Manage">Remove</a>
</td>
</tr>
}
@if (!Model.ApiKeyDatas.Any())
{
<tr>
<td colspan="4" class="text-center h5 py-2">
No API keys
</td>
</tr>
}
@foreach (var keyData in Model.ApiKeyDatas)
{
<tr>
<td>@keyData.Label</td>
<td><code>@keyData.Id</code></td>
<td>
@{
var permissions = keyData.GetBlob().Permissions;
}
@if (!permissions.Any())
{
<span class="text-warning">No permissions</span>
}
else
{
<ul>
@foreach (var permission in Permission.ToPermissions(permissions).Select(c => c.ToString()).Distinct().ToArray())
{
<li><code>@permission</code></li>
}
</ul>
}
</td>
<td class="text-right">
<a asp-action="RemoveAPIKey" asp-route-id="@keyData.Id" asp-controller="Manage">Remove</a>
</td>
</tr>
}
@if (!Model.ApiKeyDatas.Any())
{
<tr>
<td colspan="4" class="text-center h5 py-2">
No API keys
</td>
</tr>
}
</tbody>
</table>
<a class="btn btn-primary" asp-action="AddApiKey" id="AddApiKey">

View File

@ -1,12 +1,12 @@
@inject SignInManager<ApplicationUser> SignInManager
@inject SignInManager<ApplicationUser> SignInManager
<div class="nav flex-column nav-pills mb-4">
<a id="@ManageNavPages.Index.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.Index)" asp-action="Index">Profile</a>
<a id="@ManageNavPages.ChangePassword.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.ChangePassword)" asp-action="ChangePassword">Password</a>
<a id="@ManageNavPages.TwoFactorAuthentication.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.TwoFactorAuthentication)" asp-action="TwoFactorAuthentication">Two-factor authentication</a>
<a id="@ManageNavPages.U2F.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.U2F)" asp-action="U2FAuthentication">U2F Authentication</a>
<a id="@ManageNavPages.APIKeys.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.APIKeys)" asp-action="APIKeys">API Keys</a>
<a id="@ManageNavPages.Notifications.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.Notifications)" asp-action="NotificationSettings">Notifications</a>
<vc:ui-extension-point location="user-nav" />
</div>
<div class="nav flex-column nav-pills mb-4">
<a id="@ManageNavPages.Index.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.Index)" asp-action="Index">Profile</a>
<a id="@ManageNavPages.ChangePassword.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.ChangePassword)" asp-action="ChangePassword">Password</a>
<a id="@ManageNavPages.TwoFactorAuthentication.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.TwoFactorAuthentication)" asp-action="TwoFactorAuthentication">Two-factor authentication</a>
<a id="@ManageNavPages.U2F.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.U2F)" asp-action="U2FAuthentication">U2F Authentication</a>
<a id="@ManageNavPages.APIKeys.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.APIKeys)" asp-action="APIKeys">API Keys</a>
<a id="@ManageNavPages.Notifications.ToString()" class="nav-link @ViewData.IsActivePage(ManageNavPages.Notifications)" asp-action="NotificationSettings">Notifications</a>
<vc:ui-extension-point location="user-nav" />
</div>