Add option to find reports corresponding to device stats.

This commit is contained in:
2019-11-10 20:55:45 +00:00
parent dfbd9bd77f
commit 57469bef1d
3 changed files with 20 additions and 2 deletions

View File

@@ -16,8 +16,8 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
// GET: Admin/DeviceStats
public async Task<IActionResult> Index() =>
View(await _context.DeviceStats.OrderBy(d => d.Manufacturer).ThenBy(d => d.Model).ThenBy(d => d.Bus).
ToListAsync());
View(await _context.DeviceStats.Include(d => d.Report).OrderBy(d => d.Manufacturer).ThenBy(d => d.Model).
ThenBy(d => d.Bus).ToListAsync());
// GET: Admin/DeviceStats/Edit/5
public async Task<IActionResult> Edit(int? id)

View File

@@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using DiscImageChef.Server.Models;
@@ -119,5 +120,8 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
}
bool UploadedReportExists(int id) => _context.Reports.Any(e => e.Id == id);
public IActionResult Find(int id, string manufacturer, string model, string bus) =>
throw new NotImplementedException();
}
}

View File

@@ -48,6 +48,9 @@
<th>
@Html.DisplayNameFor(model => model.Bus)
</th>
<th>
Has report?
</th>
<th></th>
</tr>
</thead>
@@ -67,6 +70,17 @@
<td>
@Html.DisplayFor(modelItem => item.Bus)
</td>
<td>
@if (item.Report is null)
{
@("No")
<a asp-action="Find" asp-controller="Reports" asp-route-id="@item.Id" asp-route-manufacturer="@item.Manufacturer" asp-route-model="@item.Model" asp-route-revision="@item.Revision" asp-route-bus="@item.Bus" target="_blank">(Find)</a>
}
else
{
<a asp-action="Details" asp-controller="Devices" asp-route-id="@item.Report.Id" target="_blank">Yes</a>
}
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-secondary">Edit</a>
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>