mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Add list for USB vendors.
This commit is contained in:
@@ -53,7 +53,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Components\Admin\Pages\Usb\Vendors\" />
|
||||
<Folder Include="wwwroot\assets\"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
<NavLink class="nav-link" href="/admin/usb/products">
|
||||
USB Products
|
||||
</NavLink>
|
||||
<NavLink class="nav-link" href="/admin/usb/vendors">
|
||||
USB Vendors
|
||||
</NavLink>
|
||||
<NavLink class="nav-link" href="/admin/versions">
|
||||
Versions
|
||||
</NavLink>
|
||||
|
||||
52
Aaru.Server/Components/Admin/Pages/Usb/Vendors/List.razor
Normal file
52
Aaru.Server/Components/Admin/Pages/Usb/Vendors/List.razor
Normal file
@@ -0,0 +1,52 @@
|
||||
@page "/admin/usb/vendors"
|
||||
@attribute [Authorize]
|
||||
@layout AdminLayout
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@inject Microsoft.EntityFrameworkCore.IDbContextFactory<DbContext> DbContextFactory
|
||||
|
||||
<PageTitle>USB vendors</PageTitle>
|
||||
|
||||
@if(!_initialized)
|
||||
{
|
||||
<div class="stats-section">
|
||||
<h1 style="color: red; align-content: center; padding: 2rem">Loading...</h1>
|
||||
</div>
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
<section class="stats-section">
|
||||
<h4>USB vendors</h4>
|
||||
<table class="table table-dark table-striped table-bordered mt-4 mb-4">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th class="fw-bold bg-secondary text-light">
|
||||
@DisplayNameHelper.GetDisplayName(typeof(UsbVendor), nameof(UsbVendor.Vendor))
|
||||
</th>
|
||||
<th class="fw-bold bg-secondary text-light">
|
||||
@DisplayNameHelper.GetDisplayName(typeof(UsbVendor), nameof(UsbVendor.VendorId))
|
||||
</th>
|
||||
<th class="fw-bold bg-secondary text-light">
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach(UsbVendor item in _items)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.Vendor
|
||||
</td>
|
||||
<td>
|
||||
@item.VendorId
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-primary" href="/admin/usb/vendors/@item.VendorId" target="_blank">Details</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
28
Aaru.Server/Components/Admin/Pages/Usb/Vendors/List.razor.cs
Normal file
28
Aaru.Server/Components/Admin/Pages/Usb/Vendors/List.razor.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Aaru.Server.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DbContext = Aaru.Server.Database.DbContext;
|
||||
|
||||
namespace Aaru.Server.Components.Admin.Pages.Usb.Vendors;
|
||||
|
||||
public partial class List
|
||||
{
|
||||
bool _initialized;
|
||||
|
||||
List<UsbVendor> _items;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
StateHasChanged();
|
||||
|
||||
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
|
||||
|
||||
_items = await ctx.UsbVendors.OrderBy(static v => v.Vendor).ThenBy(static v => v.VendorId).ToListAsync();
|
||||
|
||||
_initialized = true;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user