diff --git a/Aaru.Server/Components/Admin/AdminNavMenu.razor b/Aaru.Server/Components/Admin/AdminNavMenu.razor index 100b28da..0d473057 100644 --- a/Aaru.Server/Components/Admin/AdminNavMenu.razor +++ b/Aaru.Server/Components/Admin/AdminNavMenu.razor @@ -11,6 +11,9 @@ Block descriptors + + Commands + diff --git a/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor b/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor index 8640a746..832d0a2f 100644 --- a/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor +++ b/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor @@ -15,34 +15,36 @@ return; } - - - - - - - - - - @foreach(BlockDescriptor item in _items) - { +
+
- @DisplayNameHelper.GetDisplayName(typeof(BlockDescriptor), nameof(BlockDescriptor.Density)) - - @DisplayNameHelper.GetDisplayName(typeof(BlockDescriptor), nameof(BlockDescriptor.Blocks)) - - @DisplayNameHelper.GetDisplayName(typeof(BlockDescriptor), nameof(BlockDescriptor.BlockLength)) -
+ - - - + + + - } - -
- @item.Density - - @item.Blocks - - @item.BlockLength - + @DisplayNameHelper.GetDisplayName(typeof(BlockDescriptor), nameof(BlockDescriptor.Density)) + + @DisplayNameHelper.GetDisplayName(typeof(BlockDescriptor), nameof(BlockDescriptor.Blocks)) + + @DisplayNameHelper.GetDisplayName(typeof(BlockDescriptor), nameof(BlockDescriptor.BlockLength)) +
\ No newline at end of file + + + @foreach(BlockDescriptor item in _items) + { + + + @item.Density + + + @item.Blocks + + + @item.BlockLength + + + } + + + \ No newline at end of file diff --git a/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor.cs b/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor.cs index 4264798e..5eac4748 100644 --- a/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor.cs +++ b/Aaru.Server/Components/Admin/Pages/BlockDescriptors/View.razor.cs @@ -18,9 +18,9 @@ public partial class View await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); - _items = await ctx.BlockDescriptor.OrderBy(b => b.BlockLength) - .ThenBy(b => b.Blocks) - .ThenBy(b => b.Density) + _items = await ctx.BlockDescriptor.OrderBy(static b => b.BlockLength) + .ThenBy(static b => b.Blocks) + .ThenBy(static b => b.Density) .ToListAsync(); _initialized = true; diff --git a/Aaru.Server/Components/Admin/Pages/Commands/View.razor b/Aaru.Server/Components/Admin/Pages/Commands/View.razor new file mode 100644 index 00000000..9e1fdf81 --- /dev/null +++ b/Aaru.Server/Components/Admin/Pages/Commands/View.razor @@ -0,0 +1,44 @@ +@page "/admin/commands" +@attribute [Authorize] +@layout AdminLayout + +@inject Microsoft.EntityFrameworkCore.IDbContextFactory DbContextFactory + +Commands + +@if(!_initialized) +{ +
+

Loading...

+
+ + return; +} + +
+ + + + + + + + + @foreach(Command item in _items) + { + + + + + } + +
+ @DisplayNameHelper.GetDisplayName(typeof(Command), nameof(Command.Name)) + + @DisplayNameHelper.GetDisplayName(typeof(Command), nameof(Command.Count)) +
+ @item.Name + + @item.Count +
+
\ No newline at end of file diff --git a/Aaru.Server/Components/Admin/Pages/Commands/View.razor.cs b/Aaru.Server/Components/Admin/Pages/Commands/View.razor.cs new file mode 100644 index 00000000..b90bd22b --- /dev/null +++ b/Aaru.Server/Components/Admin/Pages/Commands/View.razor.cs @@ -0,0 +1,27 @@ +using Aaru.Server.Database.Models; +using Microsoft.EntityFrameworkCore; +using DbContext = Aaru.Server.Database.DbContext; + +namespace Aaru.Server.Components.Admin.Pages.Commands; + +public partial class View +{ + bool _initialized; + List _items; + + /// + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + + StateHasChanged(); + + await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); + + _items = await ctx.Commands.OrderBy(static c => c.Name).ToListAsync(); + + _initialized = true; + + StateHasChanged(); + } +} \ No newline at end of file