mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Show similar device and uploaded reports in uploaded report details.
This commit is contained in:
@@ -28,14 +28,39 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
UploadedReport uploadedReport = await _context.Reports.FirstOrDefaultAsync(m => m.Id == id);
|
var model = new UploadedReportDetails
|
||||||
|
{
|
||||||
|
Report = await _context.Reports.FirstOrDefaultAsync(m => m.Id == id)
|
||||||
|
};
|
||||||
|
|
||||||
if(uploadedReport == null)
|
if(model.Report is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(uploadedReport);
|
model.ReportAll = _context.
|
||||||
|
Devices.Where(d => d.Manufacturer == model.Report.Manufacturer &&
|
||||||
|
d.Model == model.Report.Model &&
|
||||||
|
d.Revision == model.Report.Revision).
|
||||||
|
Select(d => d.Id).ToList();
|
||||||
|
|
||||||
|
model.ReportButManufacturer = _context.
|
||||||
|
Devices.Where(d => d.Model == model.Report.Model &&
|
||||||
|
d.Revision == model.Report.Revision).Select(d => d.Id).
|
||||||
|
Where(d => model.ReportAll.All(r => r != d)).ToList();
|
||||||
|
|
||||||
|
model.SameAll = _context.
|
||||||
|
Reports.Where(d => d.Manufacturer == model.Report.Manufacturer &&
|
||||||
|
d.Model == model.Report.Model &&
|
||||||
|
d.Revision == model.Report.Revision &&
|
||||||
|
d.Id != id).Select(d => d.Id).ToList();
|
||||||
|
|
||||||
|
model.SameButManufacturer = _context.
|
||||||
|
Reports.Where(d => d.Model == model.Report.Model &&
|
||||||
|
d.Revision == model.Report.Revision && d.Id != id).
|
||||||
|
Select(d => d.Id).Where(d => model.SameAll.All(r => r != d)).ToList();
|
||||||
|
|
||||||
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Admin/Reports/Edit/5
|
// GET: Admin/Reports/Edit/5
|
||||||
|
|||||||
@@ -1,52 +1,173 @@
|
|||||||
@model UploadedReport
|
@model UploadedReportDetails
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Details";
|
ViewData["Title"] = "Details";
|
||||||
}
|
}
|
||||||
<h1>Details</h1>
|
<h1>Details</h1>
|
||||||
<div>
|
<div>
|
||||||
<h4>UploadedReport</h4>
|
<h4>Uploaded report</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<dl class="row">
|
<dl class="row">
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.UploadedWhen)
|
@Html.DisplayNameFor(model => model.Report.UploadedWhen)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.UploadedWhen)
|
@Html.DisplayFor(model => model.Report.UploadedWhen)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.CompactFlash)
|
@Html.DisplayNameFor(model => model.Report.Manufacturer)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.CompactFlash)
|
@Html.DisplayFor(model => model.Report.Manufacturer)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Manufacturer)
|
@Html.DisplayNameFor(model => model.Report.Model)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Manufacturer)
|
@Html.DisplayFor(model => model.Report.Model)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Model)
|
@Html.DisplayNameFor(model => model.Report.Revision)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Model)
|
@Html.DisplayFor(model => model.Report.Revision)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Revision)
|
@Html.DisplayNameFor(model => model.Report.CompactFlash)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Revision)
|
@Html.DisplayFor(model => model.Report.CompactFlash)
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="col-sm-2">
|
<dt class="col-sm-2">
|
||||||
@Html.DisplayNameFor(model => model.Type)
|
@Html.DisplayNameFor(model => model.Report.Type)
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="col-sm-10">
|
<dd class="col-sm-10">
|
||||||
@Html.DisplayFor(model => model.Type)
|
@Html.DisplayFor(model => model.Report.Type)
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">Edit</a>
|
<a asp-action="Edit" asp-route-id="@Model.Report.Id" class="btn btn-primary">Edit</a>
|
||||||
|
<a asp-action="Promote" asp-route-id="@Model.Report.Id" class="btn btn-secondary">Promote</a>
|
||||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
@if (Model.SameAll.Count > 0)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<h4>Other uploaded reports with same manufacturer, model and revision:</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Id
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.SameAll)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@item
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-action="Details" asp-route-id="@item" class="btn btn-primary" target="_blank">Details</a>
|
||||||
|
<a asp-action="Merge" asp-route-slave="@item" asp-route-master="@Model.Report.Id" class="btn btn-secondary">Merge</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (Model.SameButManufacturer.Count > 0)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<h4>Other uploaded reports with same model and revision:</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Id
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.SameButManufacturer)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@item
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-action="Details" asp-route-id="@item" class="btn btn-primary" target="_blank">Details</a>
|
||||||
|
<a asp-action="Merge" asp-route-slave="@item" asp-route-master="@Model.Report.Id" class="btn btn-secondary">Merge</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (Model.ReportAll.Count > 0)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<h4>Device reports with same manufacturer, model and revision:</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Id
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.ReportAll)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@item
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-controller="Devices" asp-action="Details" asp-route-id="@item" class="btn btn-primary" target="_blank">Details</a>
|
||||||
|
<a asp-controller="Devices" asp-action="MergeReports" asp-route-deviceId="@item" asp-route-reportId="@Model.Report.Id" class="btn btn-secondary">Merge</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (Model.ReportButManufacturer.Count > 0)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<h4>Device reports with same model and revision:</h4>
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Id
|
||||||
|
</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model.ReportButManufacturer)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@item
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a asp-controller="Devices" asp-action="Details" asp-route-id="@item" class="btn btn-primary" target="_blank">Details</a>
|
||||||
|
<a asp-controller="Devices" asp-action="MergeReports" asp-route-deviceId="@item" asp-route-reportId="@Model.Report.Id" class="btn btn-secondary">Merge</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
13
DiscImageChef.Server/Models/UploadedReportDetails.cs
Normal file
13
DiscImageChef.Server/Models/UploadedReportDetails.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace DiscImageChef.Server.Models
|
||||||
|
{
|
||||||
|
public class UploadedReportDetails
|
||||||
|
{
|
||||||
|
public UploadedReport Report { get; set; }
|
||||||
|
public List<int> SameAll { get; set; }
|
||||||
|
public List<int> SameButManufacturer { get; set; }
|
||||||
|
public List<int> ReportAll { get; set; }
|
||||||
|
public List<int> ReportButManufacturer { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user