54 lines
2.1 KiB
Plaintext
54 lines
2.1 KiB
Plaintext
@page "/admin/servers/stars"
|
|
|
|
@using MoonCore.Blazor.Tailwind.MinimalCrud
|
|
@using MoonCore.Helpers
|
|
@using MoonCore.Models
|
|
@using MoonCore.Blazor.Tailwind.DataTable
|
|
@using MoonlightServers.Shared.Http.Responses.Admin.Stars
|
|
@using MoonCore.Blazor.Tailwind.Components
|
|
|
|
@inject HttpApiClient ApiClient
|
|
|
|
<div class="mb-3">
|
|
<NavTabs Index="3" Names="@UiConstants.AdminNavNames" Links="@UiConstants.AdminNavLinks"/>
|
|
</div>
|
|
|
|
<MinimalCrud TItem="StarDetailResponse" OnConfigure="OnConfigure">
|
|
<ChildContent>
|
|
<DataColumn TItem="StarDetailResponse" Field="@(x => x.Id)" Title="Id" IsSortable="true"/>
|
|
<DataColumn TItem="StarDetailResponse" Field="@(x => x.Name)" Title="Name" IsSortable="true"/>
|
|
<DataColumn TItem="StarDetailResponse" Field="@(x => x.Version)" Title="Version" IsSortable="true"/>
|
|
<DataColumn TItem="StarDetailResponse" Field="@(x => x.Author)" Title="Author"/>
|
|
</ChildContent>
|
|
<ItemActions>
|
|
@if (!string.IsNullOrEmpty(context.DonateUrl))
|
|
{
|
|
<a href="@context.DonateUrl" class="text-red-500 mr-3">
|
|
<i class="icon-heart align-middle"></i>
|
|
<span class="align-middle">Donate</span>
|
|
</a>
|
|
}
|
|
|
|
@if (!string.IsNullOrEmpty(context.UpdateUrl))
|
|
{
|
|
<a href="#" @onclick:preventDefault class="text-tertiary-500 mr-3">
|
|
<i class="icon-refresh-cw align-middle"></i>
|
|
<span class="align-middle">Update</span>
|
|
</a>
|
|
}
|
|
</ItemActions>
|
|
</MinimalCrud>
|
|
|
|
@code
|
|
{
|
|
private void OnConfigure(MinimalCrudOptions<StarDetailResponse> options)
|
|
{
|
|
options.Title = "Stars";
|
|
options.ItemLoader = async (page, pageSize) =>
|
|
await ApiClient.GetJson<PagedData<StarDetailResponse>>($"api/admin/servers/stars?page={page}&pageSize={pageSize}");
|
|
|
|
options.CreateUrl = ComponentHelper.GetRouteOfComponent<Create>();
|
|
options.UpdateUrl = item => ComponentHelper.GetRouteOfComponent<Update>(item.Id)!;
|
|
options.DeleteFunction = async item => await ApiClient.Delete($"api/admin/servers/stars/{item.Id}");
|
|
}
|
|
} |