Improved Manage API Page

This commit is contained in:
Mia Rose Winter 2024-03-27 10:19:49 +01:00
parent 0f484a5572
commit bd0d69cdc3
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
3 changed files with 30 additions and 16 deletions

View file

@ -14,8 +14,29 @@
<PageTitle>@(Localizer["Title"] + TitlePostfix)</PageTitle>
<ModalComponent Id="@ModalId">
<ChildContent>
<EditForm id="NewApiKey" method="post" FormName="NewApiKey" Model="@Model" OnValidSubmit="CreateApiKey">
<InputLabelComponent LabelText="@Localizer["Name_Label"]">
<InputText @bind-Value="@Model.Name" placeholder="@Localizer["Name_Placeholder"]"
required aria-required max="128" class="input input-bordered"
autocomplete="off" />
</InputLabelComponent>
</EditForm>
</ChildContent>
<Actions>
<button type="submit" form="NewApiKey" class="btn btn-primary">@Localizer["Submit"]</button>
</Actions>
</ModalComponent>
<h1 class="text-3xl lg:text-5xl font-light mb-6 text-primary">@Localizer["Title"]</h1>
<div class="flex gap-2 mb-3">
<button class="btn btn-sm btn-primary" onclick="@(ModalId).showModal()">
@Localizer["Key_Label"]
</button>
</div>
<section>
@if (!string.IsNullOrWhiteSpace(Key)) {
<Alert CanRemove="true" Type="Alert.MessageType.Information">
@ -61,21 +82,6 @@
</tr>
}
</tbody>
<tfoot>
<tr>
<td colspan="3">
<EditForm method="post" FormName="NewApiKey" Model="@Model" OnValidSubmit="CreateApiKey">
<div class="join join-vertical md:join-horizontal w-full">
<span class="btn no-animation join-item">@Localizer["Name_Label"]</span>
<InputText @bind-Value="@Model.Name" placeholder="@Localizer["Name_Placeholder"]"
required aria-required max="128" class="input input-bordered join-item"
autocomplete="off" />
<button type="submit" class="btn btn-primary join-item">@Localizer["Submit"]</button>
</div>
</EditForm>
</td>
</tr>
</tfoot>
</table>
</div>
</section>
@ -90,6 +96,8 @@
private string? Key { get; set; }
private static string ModalId => "CreateApiKeyDialog";
protected override async Task OnInitializedAsync() {
await using var context = await ContextFactory.CreateDbContextAsync();

View file

@ -128,4 +128,7 @@
<data name="Delete_Error" xml:space="preserve">
<value>Unerwarteter Fehler beim Versuch einen API-Schlüssel zu löschen</value>
</data>
<data name="Key_Label" xml:space="preserve">
<value>API-Schlüssel erstellen</value>
</data>
</root>

View file

@ -131,4 +131,7 @@
<data name="Delete_Success" xml:space="preserve">
<value>API Key has been deleted</value>
</data>
<data name="Key_Label" xml:space="preserve">
<value>Create API Key</value>
</data>
</root>