mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Add view for filesystems.
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
<NavLink class="nav-link" href="/admin/commands">
|
||||
Commands
|
||||
</NavLink>
|
||||
<NavLink class="nav-link" href="/admin/filesystems">
|
||||
Filesystems
|
||||
</NavLink>
|
||||
</div>
|
||||
<!-- Add more admin links here -->
|
||||
</nav>
|
||||
|
||||
44
Aaru.Server/Components/Admin/Pages/Filesystems/View.razor
Normal file
44
Aaru.Server/Components/Admin/Pages/Filesystems/View.razor
Normal file
@@ -0,0 +1,44 @@
|
||||
@page "/admin/filesystems"
|
||||
@attribute [Authorize]
|
||||
@layout AdminLayout
|
||||
|
||||
@inject Microsoft.EntityFrameworkCore.IDbContextFactory<DbContext> DbContextFactory
|
||||
|
||||
<PageTitle>Filesystems</PageTitle>
|
||||
|
||||
@if(!_initialized)
|
||||
{
|
||||
<div class="stats-section">
|
||||
<h1 style="color: red; align-content: center; padding: 2rem">Loading...</h1>
|
||||
</div>
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
<section class="stats-section">
|
||||
<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(Filesystem), nameof(Filesystem.Name))
|
||||
</th>
|
||||
<th class="fw-bold bg-secondary text-light">
|
||||
@DisplayNameHelper.GetDisplayName(typeof(Filesystem), nameof(Filesystem.Count))
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach(Filesystem item in _items)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.Name
|
||||
</td>
|
||||
<td>
|
||||
@item.Count
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
27
Aaru.Server/Components/Admin/Pages/Filesystems/View.razor.cs
Normal file
27
Aaru.Server/Components/Admin/Pages/Filesystems/View.razor.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Aaru.Server.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using DbContext = Aaru.Server.Database.DbContext;
|
||||
|
||||
namespace Aaru.Server.Components.Admin.Pages.Filesystems;
|
||||
|
||||
public partial class View
|
||||
{
|
||||
bool _initialized;
|
||||
List<Filesystem> _items;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
StateHasChanged();
|
||||
|
||||
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
|
||||
|
||||
_items = await ctx.Filesystems.OrderBy(static f => f.Name).ToListAsync();
|
||||
|
||||
_initialized = true;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user