mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
[Blazor] Implement home page.
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="2.0.0-preview1-final"/>
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="2.0.0-preview1-final"/>
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.6"/>
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.6"/>
|
||||||
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.6"/>
|
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.6"/>
|
||||||
|
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter" Version="4.12.1"/>
|
||||||
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15"/>
|
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15"/>
|
||||||
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0"/>
|
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0"/>
|
||||||
<PackageVersion Include="Mono.Fuse.NETStandard" Version="1.1.0"/>
|
<PackageVersion Include="Mono.Fuse.NETStandard" Version="1.1.0"/>
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
<PackageVersion Include="SharpCompress" Version="0.38.0"/>
|
<PackageVersion Include="SharpCompress" Version="0.38.0"/>
|
||||||
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
|
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0"/>
|
||||||
<PackageVersion Include="ZstdSharp.Port" Version="0.8.6"/>
|
<PackageVersion Include="ZstdSharp.Port" Version="0.8.6"/>
|
||||||
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.11.9" />
|
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.12.1"/>
|
||||||
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.11.9" />
|
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.12.1"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
|
@using RomRepoMgr.Database
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
@inject IDialogService DialogService
|
@inject IDialogService DialogService
|
||||||
|
@inject Context ctx
|
||||||
|
|
||||||
<PageTitle>ROM Repository Manager</PageTitle>
|
<PageTitle>ROM Repository Manager</PageTitle>
|
||||||
|
|
||||||
@@ -11,3 +13,24 @@
|
|||||||
<FluentButton Disabled="true">Import ROMs</FluentButton>
|
<FluentButton Disabled="true">Import ROMs</FluentButton>
|
||||||
<FluentButton Disabled="true">Export ROMs</FluentButton>
|
<FluentButton Disabled="true">Export ROMs</FluentButton>
|
||||||
</FluentToolbar>
|
</FluentToolbar>
|
||||||
|
|
||||||
|
<FluentDataGrid @ref="romSetsGrid" Items="@RomSets" Style="width: 100%;" AutoFit="true" Pagination="@pagination"
|
||||||
|
AutoItemsPerPage="true" ResizableColumns="true">
|
||||||
|
<PropertyColumn Property="@(p => p.Name)" Title="Name"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Version)" Title="Version"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Author)" Title="Author"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Category)" Title="Category"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Date)" Title="Date"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Description)" Title="Description"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Comment)" Title="Comment"/>
|
||||||
|
<PropertyColumn Property="@(p => p.Homepage)" Title="Homepage"/>
|
||||||
|
<PropertyColumn Property="@(p => p.TotalMachines)" Title="Total machines"/>
|
||||||
|
<PropertyColumn Property="@(p => p.CompleteMachines)" Title="Complete machines"/>
|
||||||
|
<PropertyColumn Property="@(p => p.IncompleteMachines)" Title="Incomplete machines"/>
|
||||||
|
<PropertyColumn Property="@(p => p.TotalRoms)" Title="Total ROMs"/>
|
||||||
|
<PropertyColumn Property="@(p => p.HaveRoms)" Title="Have ROMs"/>
|
||||||
|
<PropertyColumn Property="@(p => p.MissRoms)" Title="Miss ROMs"/>
|
||||||
|
|
||||||
|
</FluentDataGrid>
|
||||||
|
|
||||||
|
<FluentPaginator State="@pagination"/>
|
||||||
@@ -1,13 +1,59 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.FluentUI.AspNetCore.Components;
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
using RomRepoMgr.Blazor.Components.Dialogs;
|
using RomRepoMgr.Blazor.Components.Dialogs;
|
||||||
|
using RomRepoMgr.Core.Models;
|
||||||
|
|
||||||
namespace RomRepoMgr.Blazor.Components.Pages;
|
namespace RomRepoMgr.Blazor.Components.Pages;
|
||||||
|
|
||||||
public partial class Home : ComponentBase
|
public partial class Home : ComponentBase
|
||||||
{
|
{
|
||||||
|
readonly PaginationState pagination = new()
|
||||||
|
{
|
||||||
|
ItemsPerPage = 10
|
||||||
|
};
|
||||||
|
FluentDataGrid<RomSetModel>? romSetsGrid;
|
||||||
|
|
||||||
|
public IQueryable<RomSetModel>? RomSets { get; set; }
|
||||||
|
|
||||||
async Task ImportDatsAsync()
|
async Task ImportDatsAsync()
|
||||||
{
|
{
|
||||||
IDialogReference dialog = await DialogService.ShowDialogAsync<ImportDats>(new DialogParameters());
|
IDialogReference dialog = await DialogService.ShowDialogAsync<ImportDats>(new DialogParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
base.OnInitialized();
|
||||||
|
|
||||||
|
romSetsGrid?.SetLoadingState(true);
|
||||||
|
|
||||||
|
RomSets = ctx.RomSets.OrderBy(r => r.Name)
|
||||||
|
.ThenBy(r => r.Version)
|
||||||
|
.ThenBy(r => r.Date)
|
||||||
|
.ThenBy(r => r.Description)
|
||||||
|
.ThenBy(r => r.Comment)
|
||||||
|
.ThenBy(r => r.Filename)
|
||||||
|
.Select(r => new RomSetModel
|
||||||
|
{
|
||||||
|
Id = r.Id,
|
||||||
|
Author = r.Author,
|
||||||
|
Comment = r.Comment,
|
||||||
|
Date = r.Date,
|
||||||
|
Description = r.Description,
|
||||||
|
Filename = r.Filename,
|
||||||
|
Homepage = r.Homepage,
|
||||||
|
Name = r.Name,
|
||||||
|
Sha384 = r.Sha384,
|
||||||
|
Version = r.Version,
|
||||||
|
TotalMachines = r.Statistics.TotalMachines,
|
||||||
|
CompleteMachines = r.Statistics.CompleteMachines,
|
||||||
|
IncompleteMachines = r.Statistics.IncompleteMachines,
|
||||||
|
TotalRoms = r.Statistics.TotalRoms,
|
||||||
|
HaveRoms = r.Statistics.HaveRoms,
|
||||||
|
MissRoms = r.Statistics.MissRoms,
|
||||||
|
Category = r.Category
|
||||||
|
});
|
||||||
|
|
||||||
|
romSetsGrid?.SetLoadingState(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -70,6 +70,8 @@ builder.Services.AddDbContextFactory<Context>(options =>
|
|||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddDataGridEntityFrameworkAdapter();
|
||||||
|
|
||||||
Log.Debug("Setting the settings...");
|
Log.Debug("Setting the settings...");
|
||||||
|
|
||||||
Settings.Current = new SetSettings
|
Settings.Current = new SetSettings
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite"/>
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite"/>
|
||||||
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components"/>
|
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components"/>
|
||||||
|
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter"/>
|
||||||
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons"/>
|
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons"/>
|
||||||
<PackageReference Include="Serilog"/>
|
<PackageReference Include="Serilog"/>
|
||||||
<PackageReference Include="Serilog.AspNetCore"/>
|
<PackageReference Include="Serilog.AspNetCore"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user