Sort processors in admin page.

This commit is contained in:
2019-05-19 00:59:40 +01:00
parent 86470c6bca
commit 0e6fc2e7f2
8 changed files with 244 additions and 329 deletions

View File

@@ -31,6 +31,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Cicm.Database.Models namespace Cicm.Database.Models
{ {
@@ -45,33 +47,55 @@ namespace Cicm.Database.Models
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public int? CompanyId { get; set; } public int? CompanyId { get; set; }
[DisplayName("Model code")]
public string ModelCode { get; set; } public string ModelCode { get; set; }
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
[DisplayName("Instruction set")]
public int? InstructionSetId { get; set; } public int? InstructionSetId { get; set; }
[DisplayName("Nominal speed (MHz)")]
public double? Speed { get; set; } public double? Speed { get; set; }
public string Package { get; set; } public string Package { get; set; }
[DisplayName("General Purpose Registers")]
public int? Gprs { get; set; } public int? Gprs { get; set; }
[DisplayName("General Purporse Register size")]
public int? GprSize { get; set; } public int? GprSize { get; set; }
[DisplayName("Floating Point Registers")]
public int? Fprs { get; set; } public int? Fprs { get; set; }
[DisplayName("Floating Point Register Size")]
public int? FprSize { get; set; } public int? FprSize { get; set; }
public int? Cores { get; set; } public int? Cores { get; set; }
[DisplayName("Threads per core")]
public int? ThreadsPerCore { get; set; } public int? ThreadsPerCore { get; set; }
public string Process { get; set; } public string Process { get; set; }
[DisplayName("Process (nm)")]
public float? ProcessNm { get; set; } public float? ProcessNm { get; set; }
[DisplayName("Die size (mm²)")]
public float? DieSize { get; set; } public float? DieSize { get; set; }
public long? Transistors { get; set; } public long? Transistors { get; set; }
[DisplayName("Data bus size")]
public int? DataBus { get; set; } public int? DataBus { get; set; }
[DisplayName("Address bus size")]
public int? AddrBus { get; set; } public int? AddrBus { get; set; }
[DisplayName("SIMD registers")]
public int? SimdRegisters { get; set; } public int? SimdRegisters { get; set; }
[DisplayName("SIMD register size")]
public int? SimdSize { get; set; } public int? SimdSize { get; set; }
[DisplayName("L1 instruction cache (KiB)")]
public float? L1Instruction { get; set; } public float? L1Instruction { get; set; }
[DisplayName("L1 data cache (KiB)")]
public float? L1Data { get; set; } public float? L1Data { get; set; }
[DisplayName("L2 cache (KiB)")]
public float? L2 { get; set; } public float? L2 { get; set; }
[DisplayName("L3 cache (KiB)")]
public float? L3 { get; set; } public float? L3 { get; set; }
public virtual Company Company { get; set; } public virtual Company Company { get; set; }
[DisplayName("Instruction set")]
public virtual InstructionSet InstructionSet { get; set; } public virtual InstructionSet InstructionSet { get; set; }
public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensions { get; set; } public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensions { get; set; }
public virtual ICollection<ProcessorsByMachine> ProcessorsByMachine { get; set; } public virtual ICollection<ProcessorsByMachine> ProcessorsByMachine { get; set; }
[NotMapped]
public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown";
} }
} }

View File

@@ -55,7 +55,7 @@ namespace cicm_web.Areas.Admin.Controllers
{ {
IIncludableQueryable<Processor, InstructionSet> cicmContext = IIncludableQueryable<Processor, InstructionSet> cicmContext =
_context.Processors.Include(p => p.Company).Include(p => p.InstructionSet); _context.Processors.Include(p => p.Company).Include(p => p.InstructionSet);
return View(await cicmContext.ToListAsync()); return View(await cicmContext.OrderBy(p => p.Company.Name).ThenBy(p => p.Name).ToListAsync());
} }
// GET: Admin/Processors/Details/5 // GET: Admin/Processors/Details/5

View File

@@ -46,7 +46,7 @@
class="text-danger"> class="text-danger">
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="CompanyId" <label asp-for="Company"
class="control-label"> class="control-label">
</label> </label>
<select asp-for="CompanyId" <select asp-for="CompanyId"
@@ -54,6 +54,16 @@
asp-items="ViewBag.CompanyId"> asp-items="ViewBag.CompanyId">
</select> </select>
</div> </div>
<div class="form-group">
<label asp-for="Name"
class="control-label">
</label>
<input asp-for="Name"
class="form-control" />
<span asp-validation-for="Name"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="ModelCode" <label asp-for="ModelCode"
class="control-label"> class="control-label">
@@ -103,46 +113,6 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Gprs"
class="control-label">
</label>
<input asp-for="Gprs"
class="form-control" />
<span asp-validation-for="Gprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="GprSize"
class="control-label">
</label>
<input asp-for="GprSize"
class="form-control" />
<span asp-validation-for="GprSize"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Fprs"
class="control-label">
</label>
<input asp-for="Fprs"
class="form-control" />
<span asp-validation-for="Fprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="FprSize"
class="control-label">
</label>
<input asp-for="FprSize"
class="form-control" />
<span asp-validation-for="FprSize"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="Cores" <label asp-for="Cores"
class="control-label"> class="control-label">
@@ -223,6 +193,46 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Gprs"
class="control-label">
</label>
<input asp-for="Gprs"
class="form-control" />
<span asp-validation-for="Gprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="GprSize"
class="control-label">
</label>
<input asp-for="GprSize"
class="form-control" />
<span asp-validation-for="GprSize"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Fprs"
class="control-label">
</label>
<input asp-for="Fprs"
class="form-control" />
<span asp-validation-for="Fprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="FprSize"
class="control-label">
</label>
<input asp-for="FprSize"
class="form-control" />
<span asp-validation-for="FprSize"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="SimdRegisters" <label asp-for="SimdRegisters"
class="control-label"> class="control-label">

View File

@@ -42,6 +42,12 @@
<h4>Processor</h4> <h4>Processor</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Name)
</dt> </dt>
@@ -60,6 +66,12 @@
<dd> <dd>
@Html.DisplayFor(model => model.Introduced) @Html.DisplayFor(model => model.Introduced)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.InstructionSet)
</dt>
<dd>
@Html.DisplayFor(model => model.InstructionSet.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Speed) @Html.DisplayNameFor(model => model.Speed)
</dt> </dt>
@@ -72,30 +84,6 @@
<dd> <dd>
@Html.DisplayFor(model => model.Package) @Html.DisplayFor(model => model.Package)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Gprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Gprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.GprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.GprSize)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Fprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Fprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.FprSize)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Cores) @Html.DisplayNameFor(model => model.Cores)
</dt> </dt>
@@ -144,6 +132,30 @@
<dd> <dd>
@Html.DisplayFor(model => model.AddrBus) @Html.DisplayFor(model => model.AddrBus)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Gprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Gprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.GprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.GprSize)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Fprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Fprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.FprSize)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.SimdRegisters) @Html.DisplayNameFor(model => model.SimdRegisters)
</dt> </dt>
@@ -180,18 +192,6 @@
<dd> <dd>
@Html.DisplayFor(model => model.L3) @Html.DisplayFor(model => model.L3)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.InstructionSet)
</dt>
<dd>
@Html.DisplayFor(model => model.InstructionSet.Name)
</dd>
</dl> </dl>
<form asp-action="Delete"> <form asp-action="Delete">

View File

@@ -41,6 +41,12 @@
<h4>Processor</h4> <h4>Processor</h4>
<hr /> <hr />
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Name)
</dt> </dt>
@@ -59,6 +65,12 @@
<dd> <dd>
@Html.DisplayFor(model => model.Introduced) @Html.DisplayFor(model => model.Introduced)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.InstructionSet)
</dt>
<dd>
@Html.DisplayFor(model => model.InstructionSet.Name)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Speed) @Html.DisplayNameFor(model => model.Speed)
</dt> </dt>
@@ -71,30 +83,6 @@
<dd> <dd>
@Html.DisplayFor(model => model.Package) @Html.DisplayFor(model => model.Package)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Gprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Gprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.GprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.GprSize)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Fprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Fprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.FprSize)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.Cores) @Html.DisplayNameFor(model => model.Cores)
</dt> </dt>
@@ -143,6 +131,30 @@
<dd> <dd>
@Html.DisplayFor(model => model.AddrBus) @Html.DisplayFor(model => model.AddrBus)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Gprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Gprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.GprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.GprSize)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Fprs)
</dt>
<dd>
@Html.DisplayFor(model => model.Fprs)
</dd>
<dt>
@Html.DisplayNameFor(model => model.FprSize)
</dt>
<dd>
@Html.DisplayFor(model => model.FprSize)
</dd>
<dt> <dt>
@Html.DisplayNameFor(model => model.SimdRegisters) @Html.DisplayNameFor(model => model.SimdRegisters)
</dt> </dt>
@@ -179,21 +191,16 @@
<dd> <dd>
@Html.DisplayFor(model => model.L3) @Html.DisplayFor(model => model.L3)
</dd> </dd>
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.InstructionSet)
</dt>
<dd>
@Html.DisplayFor(model => model.InstructionSet.Name)
</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"
<a asp-action="Index" class="btn btn-secondary">Back to List</a> asp-route-id="@Model.Id"
class="btn btn-primary">
Edit
</a>
<a asp-action="Index"
class="btn btn-secondary">
Back to List
</a>
</div> </div>

View File

@@ -48,24 +48,21 @@
<input type="hidden" <input type="hidden"
asp-for="Id" /> asp-for="Id" />
<div class="form-group"> <div class="form-group">
<label asp-for="Name" <label asp-for="Company"
class="control-label">
</label>
<input asp-for="Name"
class="form-control" />
<span asp-validation-for="Name"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="CompanyId"
class="control-label"> class="control-label">
</label> </label>
<select asp-for="CompanyId" <select asp-for="CompanyId"
class="form-control" class="form-control"
asp-items="ViewBag.CompanyId"> asp-items="ViewBag.CompanyId">
</select> </select>
<span asp-validation-for="CompanyId" </div>
<div class="form-group">
<label asp-for="Name"
class="control-label">
</label>
<input asp-for="Name"
class="form-control" />
<span asp-validation-for="Name"
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
@@ -97,9 +94,6 @@
class="form-control" class="form-control"
asp-items="ViewBag.InstructionSetId"> asp-items="ViewBag.InstructionSetId">
</select> </select>
<span asp-validation-for="InstructionSetId"
class="text-danger">
</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="Speed" <label asp-for="Speed"
@@ -121,46 +115,6 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Gprs"
class="control-label">
</label>
<input asp-for="Gprs"
class="form-control" />
<span asp-validation-for="Gprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="GprSize"
class="control-label">
</label>
<input asp-for="GprSize"
class="form-control" />
<span asp-validation-for="GprSize"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Fprs"
class="control-label">
</label>
<input asp-for="Fprs"
class="form-control" />
<span asp-validation-for="Fprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="FprSize"
class="control-label">
</label>
<input asp-for="FprSize"
class="form-control" />
<span asp-validation-for="FprSize"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="Cores" <label asp-for="Cores"
class="control-label"> class="control-label">
@@ -241,6 +195,46 @@
class="text-danger"> class="text-danger">
</span> </span>
</div> </div>
<div class="form-group">
<label asp-for="Gprs"
class="control-label">
</label>
<input asp-for="Gprs"
class="form-control" />
<span asp-validation-for="Gprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="GprSize"
class="control-label">
</label>
<input asp-for="GprSize"
class="form-control" />
<span asp-validation-for="GprSize"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="Fprs"
class="control-label">
</label>
<input asp-for="Fprs"
class="form-control" />
<span asp-validation-for="Fprs"
class="text-danger">
</span>
</div>
<div class="form-group">
<label asp-for="FprSize"
class="control-label">
</label>
<input asp-for="FprSize"
class="form-control" />
<span asp-validation-for="FprSize"
class="text-danger">
</span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="SimdRegisters" <label asp-for="SimdRegisters"
class="control-label"> class="control-label">
@@ -304,7 +298,7 @@
<div class="form-group"> <div class="form-group">
<input class="btn btn-primary" <input class="btn btn-primary"
type="submit" type="submit"
value="Save" /> value="Create" />
<a asp-action="Index" <a asp-action="Index"
class="btn btn-secondary"> class="btn btn-secondary">
Back to List Back to List

View File

@@ -47,6 +47,9 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>
@Html.DisplayNameFor(model => model.Company)
</th>
<th> <th>
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Name)
</th> </th>
@@ -56,69 +59,6 @@
<th> <th>
@Html.DisplayNameFor(model => model.Introduced) @Html.DisplayNameFor(model => model.Introduced)
</th> </th>
<th>
@Html.DisplayNameFor(model => model.Speed)
</th>
<th>
@Html.DisplayNameFor(model => model.Package)
</th>
<th>
@Html.DisplayNameFor(model => model.Gprs)
</th>
<th>
@Html.DisplayNameFor(model => model.GprSize)
</th>
<th>
@Html.DisplayNameFor(model => model.Fprs)
</th>
<th>
@Html.DisplayNameFor(model => model.FprSize)
</th>
<th>
@Html.DisplayNameFor(model => model.Cores)
</th>
<th>
@Html.DisplayNameFor(model => model.ThreadsPerCore)
</th>
<th>
@Html.DisplayNameFor(model => model.Process)
</th>
<th>
@Html.DisplayNameFor(model => model.ProcessNm)
</th>
<th>
@Html.DisplayNameFor(model => model.DieSize)
</th>
<th>
@Html.DisplayNameFor(model => model.Transistors)
</th>
<th>
@Html.DisplayNameFor(model => model.DataBus)
</th>
<th>
@Html.DisplayNameFor(model => model.AddrBus)
</th>
<th>
@Html.DisplayNameFor(model => model.SimdRegisters)
</th>
<th>
@Html.DisplayNameFor(model => model.SimdSize)
</th>
<th>
@Html.DisplayNameFor(model => model.L1Instruction)
</th>
<th>
@Html.DisplayNameFor(model => model.L1Data)
</th>
<th>
@Html.DisplayNameFor(model => model.L2)
</th>
<th>
@Html.DisplayNameFor(model => model.L3)
</th>
<th>
@Html.DisplayNameFor(model => model.Company)
</th>
<th> <th>
@Html.DisplayNameFor(model => model.InstructionSet) @Html.DisplayNameFor(model => model.InstructionSet)
</th> </th>
@@ -129,6 +69,9 @@
@foreach(Processor item in Model) @foreach(Processor item in Model)
{ {
<tr> <tr>
<td>
@Html.DisplayFor(modelItem => item.Company.Name)
</td>
<td> <td>
@Html.DisplayFor(modelItem => item.Name) @Html.DisplayFor(modelItem => item.Name)
</td> </td>
@@ -136,70 +79,7 @@
@Html.DisplayFor(modelItem => item.ModelCode) @Html.DisplayFor(modelItem => item.ModelCode)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.Introduced) @Html.DisplayFor(modelItem => item.IntroducedView)
</td>
<td>
@Html.DisplayFor(modelItem => item.Speed)
</td>
<td>
@Html.DisplayFor(modelItem => item.Package)
</td>
<td>
@Html.DisplayFor(modelItem => item.Gprs)
</td>
<td>
@Html.DisplayFor(modelItem => item.GprSize)
</td>
<td>
@Html.DisplayFor(modelItem => item.Fprs)
</td>
<td>
@Html.DisplayFor(modelItem => item.FprSize)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cores)
</td>
<td>
@Html.DisplayFor(modelItem => item.ThreadsPerCore)
</td>
<td>
@Html.DisplayFor(modelItem => item.Process)
</td>
<td>
@Html.DisplayFor(modelItem => item.ProcessNm)
</td>
<td>
@Html.DisplayFor(modelItem => item.DieSize)
</td>
<td>
@Html.DisplayFor(modelItem => item.Transistors)
</td>
<td>
@Html.DisplayFor(modelItem => item.DataBus)
</td>
<td>
@Html.DisplayFor(modelItem => item.AddrBus)
</td>
<td>
@Html.DisplayFor(modelItem => item.SimdRegisters)
</td>
<td>
@Html.DisplayFor(modelItem => item.SimdSize)
</td>
<td>
@Html.DisplayFor(modelItem => item.L1Instruction)
</td>
<td>
@Html.DisplayFor(modelItem => item.L1Data)
</td>
<td>
@Html.DisplayFor(modelItem => item.L2)
</td>
<td>
@Html.DisplayFor(modelItem => item.L3)
</td>
<td>
@Html.DisplayFor(modelItem => item.Company.Name)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.InstructionSet.Name) @Html.DisplayFor(modelItem => item.InstructionSet.Name)

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
<Version>3.0.99.445</Version> <Version>3.0.99.446</Version>
<Company>Canary Islands Computer Museum</Company> <Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright> <Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product> <Product>Canary Islands Computer Museum Website</Product>