Add processor details in admin view.

This commit is contained in:
2020-05-26 04:03:53 +01:00
parent 30ab66d040
commit 249c7a7baa
10 changed files with 385 additions and 213 deletions

View File

@@ -1,201 +0,0 @@
@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : Details.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Admin view details
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
}
@model Marechai.Database.Models.Processor
@{
ViewData["Title"] = "Details";
}
<h2>Details</h2>
<div>
<h4>Processor</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Company)
</dt>
<dd>
@Html.DisplayFor(model => model.Company.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.ModelCode)
</dt>
<dd>
@Html.DisplayFor(model => model.ModelCode)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Introduced)
</dt>
<dd>
@Html.DisplayFor(model => model.Introduced)
</dd>
<dt>
@Html.DisplayNameFor(model => model.InstructionSet)
</dt>
<dd>
@Html.DisplayFor(model => model.InstructionSet.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Speed)
</dt>
<dd>
@Html.DisplayFor(model => model.Speed)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Package)
</dt>
<dd>
@Html.DisplayFor(model => model.Package)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Cores)
</dt>
<dd>
@Html.DisplayFor(model => model.Cores)
</dd>
<dt>
@Html.DisplayNameFor(model => model.ThreadsPerCore)
</dt>
<dd>
@Html.DisplayFor(model => model.ThreadsPerCore)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Process)
</dt>
<dd>
@Html.DisplayFor(model => model.Process)
</dd>
<dt>
@Html.DisplayNameFor(model => model.ProcessNm)
</dt>
<dd>
@Html.DisplayFor(model => model.ProcessNm)
</dd>
<dt>
@Html.DisplayNameFor(model => model.DieSize)
</dt>
<dd>
@Html.DisplayFor(model => model.DieSize)
</dd>
<dt>
@Html.DisplayNameFor(model => model.Transistors)
</dt>
<dd>
@Html.DisplayFor(model => model.Transistors)
</dd>
<dt>
@Html.DisplayNameFor(model => model.DataBus)
</dt>
<dd>
@Html.DisplayFor(model => model.DataBus)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AddrBus)
</dt>
<dd>
@Html.DisplayFor(model => model.AddrBus)
</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>
@Html.DisplayNameFor(model => model.SimdRegisters)
</dt>
<dd>
@Html.DisplayFor(model => model.SimdRegisters)
</dd>
<dt>
@Html.DisplayNameFor(model => model.SimdSize)
</dt>
<dd>
@Html.DisplayFor(model => model.SimdSize)
</dd>
<dt>
@Html.DisplayNameFor(model => model.L1Instruction)
</dt>
<dd>
@Html.DisplayFor(model => model.L1Instruction)
</dd>
<dt>
@Html.DisplayNameFor(model => model.L1Data)
</dt>
<dd>
@Html.DisplayFor(model => model.L1Data)
</dd>
<dt>
@Html.DisplayNameFor(model => model.L2)
</dt>
<dd>
@Html.DisplayFor(model => model.L2)
</dd>
<dt>
@Html.DisplayNameFor(model => model.L3)
</dt>
<dd>
@Html.DisplayFor(model => model.L3)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">
Edit
</a>
<a asp-action="Index" class="btn btn-secondary">
Back to List
</a>
</div>

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>3.0.99.1188</Version>
<Version>3.0.99.1192</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>
@@ -112,6 +112,9 @@
<Content Update="Pages\Admin\Details\Person.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Pages\Admin\Details\Processor.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />

View File

@@ -96,14 +96,14 @@
@if (_editable || _model.ProcessNm != null)
{
<Field>
<FieldLabel>@L["Process size in nm"]</FieldLabel>
<FieldLabel>@L["Process (nm)"]</FieldLabel>
<NumericEdit TValue="float?" Decimals="2" ReadOnly="!_editable" @bind-Text="@_model.ProcessNm" />
</Field>
}
@if (_editable || _model.DieSize != null)
{
<Field>
<FieldLabel>@L["Die size"]</FieldLabel>
<FieldLabel>@L["Die size (mm²)"]</FieldLabel>
<NumericEdit TValue="float?" Decimals="2" ReadOnly="!_editable" @bind-Text="@_model.DieSize" />
</Field>
}

View File

@@ -88,13 +88,13 @@
}
<Field>
<FieldLabel>@L["Birth date"]</FieldLabel>
<DateEdit Value="DateTime" ReadOnly="!_editable" @bind-Text="@_model.BirthDate" />
<DateEdit TValue="DateTime" ReadOnly="!_editable" @bind-Text="@_model.BirthDate" />
</Field>
@if (_editable || _model.DeathDate != null)
{
<Field>
<FieldLabel>@L["Date of death"]</FieldLabel>
<DateEdit Value="DateTime?" ReadOnly="!_editable" @bind-Text="@_model.DeathDate" />
<DateEdit TValue="DateTime?" ReadOnly="!_editable" @bind-Text="@_model.DeathDate" />
</Field>
}
@if (_editable || _model.Webpage != null)

View File

@@ -0,0 +1,243 @@
@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : Details.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Admin view details
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
}
@page "/admin/processors/details/{Id:int}"
@inherits OwningComponentBase<ProcessorsService>
@inject IStringLocalizer<ProcessorsService> L
@inject CompaniesService CompaniesService
@inject InstructionSetsService InstructionSetsService
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Processor details"]</h3>
<hr />
@if (!_loaded)
{
<p align="center">@L["Loading..."]</p>
return;
}
<div>
<Field>
<FieldLabel>@L["Name"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name"/>
</Field>
@if (_editable || _model.CompanyId != null)
{
<Field>
<FieldLabel>@L["Company"]</FieldLabel>
<Select Disabled="!_editable" TValue="int?" @bind-SelectedValue="@_model.CompanyId">
@foreach (var company in _companies)
{
<SelectItem TValue="int?" Value="@company.Id">@company.Name</SelectItem>
}
</Select>
</Field>
}
@if (_editable || _model.ModelCode != null)
{
<Field>
<FieldLabel>@L["Model code"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.ModelCode"/>
</Field>
}
@if(_editable || _model.Introduced.HasValue)
{
<Field>
<FieldLabel>@L["Introduced"]</FieldLabel>
@if(_model.Introduced?.Year == 1000)
{
<TextEdit ReadOnly="true">@L["PROTOTYPE"]</TextEdit>
}
else
{
<DateEdit ReadOnly="!_editable" TValue="DateTime?" @bind-Date="@_model.Introduced"/>
}
</Field>
}
@if (_editable || _model.InstructionSetId.HasValue)
{
<Field>
<FieldLabel>@L["Instruction set"]</FieldLabel>
<Select Disabled="!_editable" TValue="int?" @bind-SelectedValue="@_model.InstructionSetId">
@foreach (var instructionSet in _instructionSets)
{
<SelectItem TValue="int?" Value="@instructionSet.Id">@instructionSet.Name</SelectItem>
}
</Select>
</Field>
}
@if (_editable || _model.Speed.HasValue)
{
<Field>
<FieldLabel>@L["Nominal speed (MHz)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="double?" Decimals="3" @bind-Value="@_model.Speed"/>
</Field>
}
@if (_editable || _model.Package != null)
{
<Field>
<FieldLabel>@L["Package"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Package"/>
</Field>
}
@if (_editable || _model.Gprs.HasValue)
{
<Field>
<FieldLabel>@L["General Purpose Registers"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.Gprs"/>
</Field>
}
@if (_editable || _model.GprSize.HasValue)
{
<Field>
<FieldLabel>@L["General Purpose Register size"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.GprSize"/>
</Field>
}
@if (_editable || _model.Fprs.HasValue)
{
<Field>
<FieldLabel>@L["Floating Point Registers"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.Fprs"/>
</Field>
}
@if (_editable || _model.FprSize.HasValue)
{
<Field>
<FieldLabel>@L["Floating Point Register size"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.FprSize"/>
</Field>
}
@if (_editable || _model.SimdRegisters.HasValue)
{
<Field>
<FieldLabel>@L["SIMD Registers"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.SimdRegisters"/>
</Field>
}
@if (_editable || _model.SimdSize.HasValue)
{
<Field>
<FieldLabel>@L["SIMD Register size"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.SimdSize"/>
</Field>
}
@if (_editable || _model.Cores.HasValue)
{
<Field>
<FieldLabel>@L["Cores"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.Cores"/>
</Field>
}
@if (_editable || _model.ThreadsPerCore.HasValue)
{
<Field>
<FieldLabel>@L["Threads per core"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.ThreadsPerCore"/>
</Field>
}
@if (_editable || _model.Process != null)
{
<Field>
<FieldLabel>@L["Process"]</FieldLabel>
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Process"/>
</Field>
}
@if (_editable || _model.ProcessNm.HasValue)
{
<Field>
<FieldLabel>@L["Process (nm)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="float?" Decimals="2" @bind-Value="@_model.ProcessNm"/>
</Field>
}
@if (_editable || _model.DieSize.HasValue)
{
<Field>
<FieldLabel>@L["Die size (mm²)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="float?" Decimals="2" @bind-Value="@_model.DieSize"/>
</Field>
}
@if (_editable || _model.Transistors.HasValue)
{
<Field>
<FieldLabel>@L["Transistors"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="long?" Decimals="0" @bind-Value="@_model.Transistors"/>
</Field>
}
@if (_editable || _model.DataBus.HasValue)
{
<Field>
<FieldLabel>@L["Data bus size"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.DataBus"/>
</Field>
}
@if (_editable || _model.AddrBus.HasValue)
{
<Field>
<FieldLabel>@L["Address bus size"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="int?" Decimals="0" @bind-Value="@_model.AddrBus"/>
</Field>
}
@if (_editable || _model.L1Instruction.HasValue)
{
<Field>
<FieldLabel>@L["L1 instruction cache (KiB)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="float?" Decimals="3" @bind-Value="@_model.L1Instruction"/>
</Field>
}
@if (_editable || _model.L1Data.HasValue)
{
<Field>
<FieldLabel>@L["L1 data cache (KiB)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="float?" Decimals="3" @bind-Value="@_model.L1Data"/>
</Field>
}
@if (_editable || _model.L2.HasValue)
{
<Field>
<FieldLabel>@L["L2 cache (KiB)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="float?" Decimals="3" @bind-Value="@_model.L2"/>
</Field>
}
@if (_editable || _model.L3.HasValue)
{
<Field>
<FieldLabel>@L["L3 cache (KiB)"]</FieldLabel>
<NumericEdit Disabled="!_editable" TValue="float?" Decimals="3" @bind-Value="@_model.L3"/>
</Field>
}
</div>
<div>
<span class="btn btn-primary">@L["Edit"]</span>
<a href="/admin/processors" class="btn btn-secondary">@L["Back to list"]</a>
</div>

View File

@@ -0,0 +1,35 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Marechai.ViewModels;
using Microsoft.AspNetCore.Components;
namespace Marechai.Pages.Admin.Details
{
public partial class Processor
{
List<CompanyViewModel> _companies;
bool _editable;
List<Database.Models.InstructionSet> _instructionSets;
bool _loaded;
Database.Models.Processor _model;
[Parameter]
public int Id { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if(_loaded)
return;
_loaded = true;
if(Id <= 0)
return;
_companies = await CompaniesService.GetAsync();
_instructionSets = await InstructionSetsService.GetAsync();
_model = await Service.GetAsync(Id);
StateHasChanged();
}
}
}

View File

@@ -87,9 +87,7 @@
@item.InstructionSet
</td>
<td>
<span class="btn btn-primary">
@L["Details"]
</span>
<a class="btn btn-primary" href="/admin/processors/details/@item.Id">@L["Details"]</a>
<span class="btn btn-secondary">
@L["Edit"]
</span>

View File

@@ -186,13 +186,13 @@
<value>Proceso</value>
<comment>Process</comment>
</data>
<data name="Process size in nm" xml:space="preserve">
<data name="Process (nm)" xml:space="preserve">
<value>Tamaño en nm del proceso</value>
<comment>Process size in nm</comment>
</data>
<data name="Die size" xml:space="preserve">
<value>Área del chip</value>
<comment>Die size</comment>
<data name="Die size (mm²)" xml:space="preserve">
<value>Área del chip (mm²)</value>
<comment>Die size (mm²)</comment>
</data>
<data name="Transistors" xml:space="preserve">
<value>Transistores</value>

View File

@@ -174,4 +174,96 @@
<value>Cancelar</value>
<comment>Cancel</comment>
</data>
<data name="Processor details" xml:space="preserve">
<value>Detalles de procesador</value>
<comment>Processor details</comment>
</data>
<data name="Back to list" xml:space="preserve">
<value>Volver a la lista</value>
<comment>Back to list</comment>
</data>
<data name="PROTOTYPE" xml:space="preserve">
<value>PROTOTIPO</value>
<comment>PROTOTYPE</comment>
</data>
<data name="Nominal speed (MHz)" xml:space="preserve">
<value>Velocidad nominal (MHz)</value>
<comment>Nominal speed (MHz)</comment>
</data>
<data name="Package" xml:space="preserve">
<value>Empaquetado</value>
<comment>Package</comment>
</data>
<data name="General Purpose Registers" xml:space="preserve">
<value>Registros de propósito general</value>
<comment>General Purpose Registers</comment>
</data>
<data name="General Purpose Register size" xml:space="preserve">
<value>Tamaño de los registros de propósito general</value>
<comment>General Purpose Register size</comment>
</data>
<data name="Floating Point Registers" xml:space="preserve">
<value>Registros de coma flotante</value>
<comment>Floating Point Registers</comment>
</data>
<data name="Floating Point Register size" xml:space="preserve">
<value>Tamaño de los registros de coma flotante</value>
<comment>Floating Point Register size</comment>
</data>
<data name="SIMD Registers" xml:space="preserve">
<value>Registros SIMD</value>
<comment>SIMD Registers</comment>
</data>
<data name="SIMD Register size" xml:space="preserve">
<value>Tamaño de los registros SIMD</value>
<comment>SIMD Register size</comment>
</data>
<data name="Cores" xml:space="preserve">
<value>Núcleos</value>
<comment>Cores</comment>
</data>
<data name="Threads per core" xml:space="preserve">
<value>Hilos por núcleo</value>
<comment>Threads per core</comment>
</data>
<data name="Process" xml:space="preserve">
<value>Proceso</value>
<comment>Process</comment>
</data>
<data name="Process (nm)" xml:space="preserve">
<value>Tamaño del proceso en nm</value>
<comment>Process (nm)</comment>
</data>
<data name="Die size (mm²)" xml:space="preserve">
<value>Area del chip (mm²)</value>
<comment>Die size (mm²)</comment>
</data>
<data name="Transistors" xml:space="preserve">
<value>Transistores</value>
<comment>Transistors</comment>
</data>
<data name="Data bus size" xml:space="preserve">
<value>Tamaño del bus de datos</value>
<comment>Data bus size</comment>
</data>
<data name="Address bus size" xml:space="preserve">
<value>Tamaño del bus de direcciones</value>
<comment>Address bus size</comment>
</data>
<data name="L1 instruction cache (KiB)" xml:space="preserve">
<value>Caché L1 de instrucciones (KiB)</value>
<comment>L1 instruction cache (KiB)</comment>
</data>
<data name="L1 data cache (KiB)" xml:space="preserve">
<value>Caché L1 de datos (KiB)</value>
<comment>L1 data cache (KiB)</comment>
</data>
<data name="L2 cache (KiB)" xml:space="preserve">
<value>Caché L2 (KiB)</value>
<comment>L2 cache (KiB)</comment>
</data>
<data name="L3 cache (KiB)" xml:space="preserve">
<value>Caché L3 (KiB)</value>
<comment>L3 cache (KiB)</comment>
</data>
</root>

View File

@@ -42,6 +42,8 @@ namespace Marechai.Services
p.Processor.InstructionSetExtensions.Select(e => e.Extension.Extension).ToList()
}).ToListAsync();
public async Task<Processor> GetAsync(int id) => await _context.Processors.FindAsync(id);
public async Task DeleteAsync(int id)
{
Processor item = await _context.Processors.FindAsync(id);