From f77f03d39d32aa7981efd5fd9ec49d28732eaa3c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 25 May 2020 22:57:03 +0100 Subject: [PATCH] Add GPU details in admin view. --- .../Areas/Admin/Views/Gpus/Details.cshtml | 105 --------------- Marechai/Marechai.csproj | 5 +- Marechai/Pages/Admin/Details/Gpu.razor | 121 ++++++++++++++++++ Marechai/Pages/Admin/Details/Gpu.razor.cs | 33 +++++ Marechai/Pages/Admin/Gpus.razor | 4 +- .../Resources/Services/GpusService.es.resx | 28 ++++ Marechai/Services/GpusService.cs | 2 + codealike.json | 2 +- 8 files changed, 190 insertions(+), 110 deletions(-) delete mode 100644 Marechai/Areas/Admin/Views/Gpus/Details.cshtml create mode 100644 Marechai/Pages/Admin/Details/Gpu.razor create mode 100644 Marechai/Pages/Admin/Details/Gpu.razor.cs diff --git a/Marechai/Areas/Admin/Views/Gpus/Details.cshtml b/Marechai/Areas/Admin/Views/Gpus/Details.cshtml deleted file mode 100644 index fe315797..00000000 --- a/Marechai/Areas/Admin/Views/Gpus/Details.cshtml +++ /dev/null @@ -1,105 +0,0 @@ -@{ - /****************************************************************************** -// MARECHAI: Master repository of computing history artifacts information -// ---------------------------------------------------------------------------- -// -// Filename : Details.cshtml -// Author(s) : Natalia Portillo -// -// --[ 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 . -// -// ---------------------------------------------------------------------------- -// Copyright © 2003-2020 Natalia Portillo -*******************************************************************************/ -} -@model Marechai.Database.Models.Gpu - -@{ - ViewData["Title"] = "Details"; -} -

Details

-
-

GPU

-
-
-
- @Html.DisplayNameFor(model => model.Company) -
-
- @Html.DisplayFor(model => model.Company.Name) -
-
- @Html.DisplayNameFor(model => model.Name) -
-
- @Html.DisplayFor(model => model.Name) -
-
- @Html.DisplayNameFor(model => model.ModelCode) -
-
- @Html.DisplayFor(model => model.ModelCode) -
-
- @Html.DisplayNameFor(model => model.Introduced) -
-
- @Html.DisplayFor(model => model.IntroducedView) -
-
- @Html.DisplayNameFor(model => model.Package) -
-
- @Html.DisplayFor(model => model.Package) -
-
- @Html.DisplayNameFor(model => model.Process) -
-
- @Html.DisplayFor(model => model.Process) -
-
- @Html.DisplayNameFor(model => model.ProcessNm) -
-
- @Html.DisplayFor(model => model.ProcessNm) -
-
- @Html.DisplayNameFor(model => model.DieSize) -
-
- @Html.DisplayFor(model => model.DieSize) -
-
- @Html.DisplayNameFor(model => model.Transistors) -
-
- @Html.DisplayFor(model => model.Transistors) -
-
-
-
- - Edit - - - Back to List - -
\ No newline at end of file diff --git a/Marechai/Marechai.csproj b/Marechai/Marechai.csproj index b968971e..f119b279 100644 --- a/Marechai/Marechai.csproj +++ b/Marechai/Marechai.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 - 3.0.99.1171 + 3.0.99.1179 Canary Islands Computer Museum Copyright © 2003-2020 Natalia Portillo Canary Islands Computer Museum Website @@ -91,6 +91,9 @@ true + + true + <_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" /> diff --git a/Marechai/Pages/Admin/Details/Gpu.razor b/Marechai/Pages/Admin/Details/Gpu.razor new file mode 100644 index 00000000..8e062c99 --- /dev/null +++ b/Marechai/Pages/Admin/Details/Gpu.razor @@ -0,0 +1,121 @@ +@{ + /****************************************************************************** +// MARECHAI: Master repository of computing history artifacts information +// ---------------------------------------------------------------------------- +// +// Filename : Details.cshtml +// Author(s) : Natalia Portillo +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2003-2020 Natalia Portillo +*******************************************************************************/ +} + +@page "/admin/gpus/details/{Id:int}" +@inherits OwningComponentBase +@inject IStringLocalizer L +@inject CompaniesService CompaniesService +@attribute [Authorize(Roles = "UberAdmin, Admin")] +

@L["Graphical processing unit details"]

+
+ +@if (!_loaded) +{ +

@L["Loading..."]

+ + return; +} + +
+ @if (_editable || _model.CompanyId != null) + { + + @L["Company"] + + + } + @if (_editable || _model.Name != null) + { + + @L["Name"] + + + } + @if (_editable || _model.ModelCode != null) + { + + @L["Model code"] + + + } + @if (_editable || _model.Introduced != null) + { + + @L["Introduced"] + + + } + @if (_editable || _model.Package != null) + { + + @L["Package"] + + + } + @if (_editable || _model.Process != null) + { + + @L["Process"] + + + } + @if (_editable || _model.ProcessNm != null) + { + + @L["Process size in nm"] + + + } + @if (_editable || _model.DieSize != null) + { + + @L["Die size"] + + + } + @if (_editable || _model.Transistors != null) + { + + @L["Transistors"] + + + } +
+
+ @L["Edit"] + @L["Back to list"] +
\ No newline at end of file diff --git a/Marechai/Pages/Admin/Details/Gpu.razor.cs b/Marechai/Pages/Admin/Details/Gpu.razor.cs new file mode 100644 index 00000000..8d063e2a --- /dev/null +++ b/Marechai/Pages/Admin/Details/Gpu.razor.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Marechai.ViewModels; +using Microsoft.AspNetCore.Components; + +namespace Marechai.Pages.Admin.Details +{ + public partial class Gpu + { + List _companies; + bool _editable; + bool _loaded; + Database.Models.Gpu _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(); + _model = await Service.GetAsync(Id); + + StateHasChanged(); + } + } +} \ No newline at end of file diff --git a/Marechai/Pages/Admin/Gpus.razor b/Marechai/Pages/Admin/Gpus.razor index 789b4bb1..7ab0c55c 100644 --- a/Marechai/Pages/Admin/Gpus.razor +++ b/Marechai/Pages/Admin/Gpus.razor @@ -81,9 +81,7 @@ @item.IntroducedView - - @L["Details"] - + @L["Details"] @L["Edit"] diff --git a/Marechai/Resources/Services/GpusService.es.resx b/Marechai/Resources/Services/GpusService.es.resx index 136346bc..c35b39df 100644 --- a/Marechai/Resources/Services/GpusService.es.resx +++ b/Marechai/Resources/Services/GpusService.es.resx @@ -170,4 +170,32 @@ Cancelar Cancel + + Detalles de unidad de proceso gráfico + Graphical processing unit details + + + Volver a la lista + Back to list + + + Empaquetado + Package + + + Proceso + Process + + + Tamaño en nm del proceso + Process size in nm + + + Área del chip + Die size + + + Transistores + Transistors + \ No newline at end of file diff --git a/Marechai/Services/GpusService.cs b/Marechai/Services/GpusService.cs index 3c154efb..2d52a441 100644 --- a/Marechai/Services/GpusService.cs +++ b/Marechai/Services/GpusService.cs @@ -31,6 +31,8 @@ namespace Marechai.Services Transistors = g.Transistors }).ToListAsync(); + public async Task GetAsync(int id) => await _context.Gpus.FindAsync(id); + public async Task DeleteAsync(int id) { Gpu item = await _context.Gpus.FindAsync(id); diff --git a/codealike.json b/codealike.json index dacdf072..ea20eadf 100644 --- a/codealike.json +++ b/codealike.json @@ -1 +1 @@ -{"projectId":"9fc561fc-2850-4b18-8a34-33bab85e34e1","projectName":"Marechai"} \ No newline at end of file +{"projectId":"db06ff35-f00a-4492-a887-0e2c62d6c2ba","projectName":"Marechai"} \ No newline at end of file