Add FireWire to device report view.

This commit is contained in:
2024-05-06 02:08:39 +01:00
parent 19e8b044a8
commit 3fd38ee1cd
2 changed files with 47 additions and 1 deletions

View File

@@ -30,7 +30,7 @@
<Accordion class="stats-section">
@if(UsbItem is not null)
{
<AccordionItem @bind-Visible="@accordionItem1Visible">
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5">
<AccordionToggle>USB characteristics</AccordionToggle>
@@ -60,4 +60,36 @@
</AccordionBody>
</AccordionItem>
}
@if(FireWireItem is not null)
{
<AccordionItem>
<AccordionHeader>
<Heading Size="HeadingSize.Is5">
<AccordionToggle>FireWire characteristics</AccordionToggle>
</Heading>
</AccordionHeader>
<AccordionBody>
<Table FullWidth>
<TableBody>
<TableRow>
<TableRowHeader class="text-end">Manufacturer</TableRowHeader>
<TableRowCell>@FireWireItem.Manufacturer</TableRowCell>
</TableRow>
<TableRow>
<TableRowHeader class="text-end">Product</TableRowHeader>
<TableRowCell>@FireWireItem.Product</TableRowCell>
</TableRow>
<TableRow>
<TableRowHeader class="text-end">Vendor ID</TableRowHeader>
<TableRowCell>@FireWireItem.VendorDescription</TableRowCell>
</TableRow>
<TableRow>
<TableRowHeader class="text-end">Product ID</TableRowHeader>
<TableRowCell>@FireWireItem.ProductDescription</TableRowCell>
</TableRow>
</TableBody>
</Table>
</AccordionBody>
</AccordionItem>
}
</Accordion>

View File

@@ -17,6 +17,8 @@ public partial class View
public int Id { get; set; }
public Item? UsbItem { get; set; }
public Item? FireWireItem { get; set; }
/// <inheritdoc />
protected override async Task OnInitializedAsync()
{
@@ -35,6 +37,7 @@ public partial class View
await using DbContext ctx = await DbContextFactory.CreateDbContextAsync();
Device? report = await ctx.Devices.Include(static deviceReportV2 => deviceReportV2.USB)
.Include(deviceReportV2 => deviceReportV2.FireWire)
.FirstOrDefaultAsync(d => d.Id == Id);
if(report is null)
@@ -82,6 +85,17 @@ public partial class View
};
}
if(report.FireWire != null)
{
FireWireItem = new Item
{
Manufacturer = report.FireWire.Manufacturer,
Product = report.FireWire.Product,
VendorDescription = $"0x{report.FireWire.VendorID:x8}",
ProductDescription = $"0x{report.FireWire.ProductID:x8}"
};
}
_initialized = true;
StateHasChanged();