mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Move GPUs admin index to Blazor.
This commit is contained in:
@@ -34,16 +34,10 @@
|
||||
<h2>Administration</h2>
|
||||
<div class="content">
|
||||
<h3>Database administrative pages</h3>
|
||||
<a asp-controller="BrowserTests">Browser tests</a>
|
||||
<br />
|
||||
<a asp-controller="Companies">Companies</a>
|
||||
<br />
|
||||
<a asp-controller="CompanyDescriptions">Company descriptions</a>
|
||||
<br />
|
||||
<a asp-controller="CompanyLogos">Company logos</a>
|
||||
<br />
|
||||
<a asp-controller="Gpus">GPUs</a>
|
||||
<br />
|
||||
<a asp-controller="GpusByMachine">GPUs by machine</a>
|
||||
<br />
|
||||
<a asp-controller="InstructionSets">Instruction sets</a>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>3.0.99.1052</Version>
|
||||
<Version>3.0.99.1053</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
@@ -49,6 +49,9 @@
|
||||
<Content Update="Pages\Admin\DocumentPeople.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Pages\Admin\Gpus.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
@{
|
||||
/******************************************************************************
|
||||
// MARECHAI: Master repository of computing history artifacts information
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Index.cshtml
|
||||
// Filename : DocumentPeople.razor
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Admin view index
|
||||
// List of graphics processing units
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
@@ -29,63 +29,79 @@
|
||||
// Copyright © 2003-2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
}
|
||||
@model IEnumerable<Marechai.Areas.Admin.Models.GpuViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "GPUs (Admin)";
|
||||
@page "/admin/gpus"
|
||||
@inherits OwningComponentBase<GpusService>
|
||||
@inject IStringLocalizer<GpusService> L
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Graphics Processing Units"]</h3>
|
||||
@if (_gpus is null)
|
||||
{
|
||||
<p>@L["Loading..."]</p>
|
||||
|
||||
return;
|
||||
}
|
||||
<h2>GPUs</h2>
|
||||
<p>
|
||||
<a asp-action="Create" class="btn btn-primary">
|
||||
Create New
|
||||
</a>
|
||||
<span class="btn btn-primary">
|
||||
@L["Create New"]
|
||||
</span>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Company)
|
||||
@L["Company"]
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
@L["Name"]
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ModelCode)
|
||||
@L["Model code"]
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Introduced)
|
||||
@L["Introduced"]
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
@foreach (var item in _gpus)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Company)
|
||||
@item.Company
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
@item.Name
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ModelCode)
|
||||
@item.ModelCode
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.IntroducedView)
|
||||
@item.IntroducedView
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary">
|
||||
Details
|
||||
</a>
|
||||
<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>
|
||||
<span class="btn btn-primary">
|
||||
@L["Details"]
|
||||
</span>
|
||||
<span class="btn btn-secondary">
|
||||
@L["Edit"]
|
||||
</span>
|
||||
<span class="btn btn-danger">
|
||||
@L["Delete"]
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
@code
|
||||
{
|
||||
List<GpuViewModel> _gpus;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_gpus = await Service.GetAsync();
|
||||
}
|
||||
}
|
||||
@@ -36,19 +36,36 @@
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Administration area"]</h3>
|
||||
<p>@L["Welcome to the administration area. Act with care!"]</p>
|
||||
<ul>
|
||||
<AuthorizeView Roles="UberAdmin">
|
||||
<div class="content">
|
||||
<h3>@L["Database administrative pages"]</h3>
|
||||
<ul>
|
||||
<AuthorizeView Roles="UberAdmin">
|
||||
<li>
|
||||
<a href="/admin/browser_tests">@L["Browser tests"]</a>
|
||||
</li>
|
||||
</AuthorizeView>
|
||||
<li>
|
||||
<a href="/admin/browser_tests">@L["Browser tests"]</a>
|
||||
<a href="/admin/companies">@L["Companies"]</a>
|
||||
</li>
|
||||
</AuthorizeView>
|
||||
<li>
|
||||
<a href="/admin/companies">@L["Companies"]</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/document_companies">@L["Document companies"]</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/document_people">@L["Document people"]</a>
|
||||
</li>
|
||||
</ul>
|
||||
<li>
|
||||
<a href="/admin/gpus">@L["Graphics Processing Units"]</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3>@L["Administrative pages for documents"]</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/admin/document_companies">@L["Document companies"]</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/document_people">@L["Document people"]</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3>@L["Administrative pages for owned machines"]</h3>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3>@L["User administrative pages"]</h3>
|
||||
</div>
|
||||
@@ -146,4 +146,24 @@
|
||||
<value>Personas de documentos</value>
|
||||
<comment>Document people.</comment>
|
||||
</data>
|
||||
<data name="Graphics Processing Units" xml:space="preserve">
|
||||
<value>Unidades de proceso de gráficos</value>
|
||||
<comment>Graphics Processing Units.</comment>
|
||||
</data>
|
||||
<data name="Database administrative pages" xml:space="preserve">
|
||||
<value>Páginas de administración de la base de datos</value>
|
||||
<comment>Database administrative pages.</comment>
|
||||
</data>
|
||||
<data name="Administrative pages for documents" xml:space="preserve">
|
||||
<value>Páginas de administración de documentos</value>
|
||||
<comment>Administrative pages for documents.</comment>
|
||||
</data>
|
||||
<data name="Administrative pages for owned machines" xml:space="preserve">
|
||||
<value>Páginas de administración para máquinas en propiedad</value>
|
||||
<comment>Administrative pages for owned machines.</comment>
|
||||
</data>
|
||||
<data name="User administrative pages" xml:space="preserve">
|
||||
<value>Páginas de administración de usuarios</value>
|
||||
<comment>User administrative pages.</comment>
|
||||
</data>
|
||||
</root>
|
||||
161
Marechai/Resources/Services/GpusService.es.resx
Normal file
161
Marechai/Resources/Services/GpusService.es.resx
Normal file
@@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- ReSharper disable MarkupTextTypo -->
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Graphics Processing Units" xml:space="preserve">
|
||||
<value>Unidades de proceso de gráficos</value>
|
||||
<comment>Graphics Processing Units.</comment>
|
||||
</data>
|
||||
<data name="Loading..." xml:space="preserve">
|
||||
<value>Cargando...</value>
|
||||
<comment>Message that appears while data is being loaded from database</comment>
|
||||
</data>
|
||||
<data name="Company" xml:space="preserve">
|
||||
<value>Compañía</value>
|
||||
<comment>Company</comment>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Nombre</value>
|
||||
<comment>Name</comment>
|
||||
</data>
|
||||
<data name="Model code" xml:space="preserve">
|
||||
<value>Modelo</value>
|
||||
<comment>Model code</comment>
|
||||
</data>
|
||||
<data name="Introduced" xml:space="preserve">
|
||||
<value>Introducida en</value>
|
||||
<comment>Introduced</comment>
|
||||
</data>
|
||||
<data name="Create new" xml:space="preserve">
|
||||
<value>Crear nueva</value>
|
||||
<comment>Create new document company</comment>
|
||||
</data>
|
||||
<data name="Details" xml:space="preserve">
|
||||
<value>Detalles</value>
|
||||
<comment>Details</comment>
|
||||
</data>
|
||||
<data name="Edit" xml:space="preserve">
|
||||
<value>Editar</value>
|
||||
<comment>Edit</comment>
|
||||
</data>
|
||||
<data name="Delete" xml:space="preserve">
|
||||
<value>Eliminar</value>
|
||||
<comment>Delete</comment>
|
||||
</data>
|
||||
</root>
|
||||
24
Marechai/Services/GpusService.cs
Normal file
24
Marechai/Services/GpusService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Marechai.Database.Models;
|
||||
using Marechai.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Marechai.Services
|
||||
{
|
||||
public class GpusService
|
||||
{
|
||||
readonly MarechaiContext _context;
|
||||
|
||||
public GpusService(MarechaiContext context) => _context = context;
|
||||
|
||||
public async Task<List<GpuViewModel>> GetAsync() => await _context.Gpus.Include(g => g.Company).OrderBy(g => g.Company.Name).ThenBy(g => g.Name).
|
||||
ThenBy(g => g.Introduced).Select(g => new GpuViewModel
|
||||
{
|
||||
Id = g.Id, Company = g.Company.Name,
|
||||
Introduced = g.Introduced,
|
||||
ModelCode = g.ModelCode, Name = g.Name
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ namespace Marechai.Services
|
||||
services.AddScoped<BrowserTestsService>();
|
||||
services.AddScoped<DocumentCompaniesService>();
|
||||
services.AddScoped<DocumentPeopleService>();
|
||||
services.AddScoped<GpusService>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,7 @@ namespace Marechai.ViewModels
|
||||
public float? ProcessNm { get; set; }
|
||||
public float? DieSize { get; set; }
|
||||
public long? Transistors { get; set; }
|
||||
|
||||
public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user