diff --git a/Aaru.Server/Components/Admin/Pages/Ata/Details.razor b/Aaru.Server/Components/Admin/Pages/Ata/Details.razor new file mode 100644 index 00000000..cabd9dbc --- /dev/null +++ b/Aaru.Server/Components/Admin/Pages/Ata/Details.razor @@ -0,0 +1,36 @@ +@page "/admin/ata/{id:int}" +@using Aaru.Decoders.ATA +@attribute [Authorize] +@layout AdminLayout +@rendermode InteractiveServer + +@inject Microsoft.EntityFrameworkCore.IDbContextFactory DbContextFactory + +ATA IDENTIFY DEVICE response + +@if(!_initialized) +{ +
+

Loading...

+
+ + return; +} + +
+
+

ATA IDENTIFY DEVICE response

+
+ @((MarkupString)Identify.Prettify(_model?.Identify)?.Replace("\n", "
"))) +
+
+ + + +
+
+ Back to List +
+
diff --git a/Aaru.Server/Components/Admin/Pages/Ata/Details.razor.cs b/Aaru.Server/Components/Admin/Pages/Ata/Details.razor.cs new file mode 100644 index 00000000..39cb531d --- /dev/null +++ b/Aaru.Server/Components/Admin/Pages/Ata/Details.razor.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.EntityFrameworkCore; +using DbContext = Aaru.Server.Database.DbContext; + +namespace Aaru.Server.Components.Admin.Pages.Ata; + +public partial class Details +{ + private int _compareId; + bool _initialized; + CommonTypes.Metadata.Ata? _model; + + [Parameter] + public int Id { get; set; } + + [Inject] + private NavigationManager NavigationManager { get; set; } = default!; + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + + StateHasChanged(); + + await using DbContext ctx = await DbContextFactory.CreateDbContextAsync(); + + _model = await ctx.Ata.FirstOrDefaultAsync(m => m.Id == Id); + + _initialized = true; + + StateHasChanged(); + } + + private void GoToCompare() + { + if(_compareId <= 0 || !(_model?.Id > 0)) return; + + string url = $"/admin/ata/{_model.Id}/compare/{_compareId}"; + NavigationManager.NavigateTo(url); + } +} \ No newline at end of file