mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Move machines admin index to Blazor.
This commit is contained in:
@@ -42,8 +42,6 @@
|
||||
<br />
|
||||
<a asp-controller="InstructionSetExtensionsByProcessor">Instruction set extensions by processor</a>
|
||||
<br />
|
||||
<a asp-controller="Machines">Machines</a>
|
||||
<br />
|
||||
<a asp-controller="MachinePhotos">Machine photos</a>
|
||||
<br />
|
||||
<a asp-controller="MemoryByMachines">Memory by machines</a>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>3.0.99.1059</Version>
|
||||
<Version>3.0.99.1060</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
@@ -64,6 +64,9 @@
|
||||
<Content Update="Pages\Admin\MachineFamilies.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Pages\Admin\Machines.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
||||
|
||||
@@ -62,6 +62,9 @@
|
||||
<li>
|
||||
<a href="/admin/machine_families">@L["Machine families"]</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/machines">@L["Machines"]</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
119
Marechai/Pages/Admin/Machines.razor
Normal file
119
Marechai/Pages/Admin/Machines.razor
Normal file
@@ -0,0 +1,119 @@
|
||||
@{
|
||||
/******************************************************************************
|
||||
// MARECHAI: Master repository of computing history artifacts information
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Machines.razor
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// List of machines
|
||||
//
|
||||
// --[ 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/machines"
|
||||
@inherits OwningComponentBase<MachinesService>
|
||||
@inject IStringLocalizer<MachinesService> L
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Machines"]</h3>
|
||||
@if (_machines is null)
|
||||
{
|
||||
<p>@L["Loading..."]</p>
|
||||
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<span class="btn btn-primary">
|
||||
@L["Create new"]
|
||||
</span>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@L["Company"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Family"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Name"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Model"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Introduced"]
|
||||
</th>
|
||||
<th>
|
||||
@L["Type"]
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in _machines)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.Company
|
||||
</td>
|
||||
<td>
|
||||
@item.Family
|
||||
</td>
|
||||
<td>
|
||||
@item.Name
|
||||
</td>
|
||||
<td>
|
||||
@item.Model
|
||||
</td>
|
||||
<td>
|
||||
@item.IntroducedView
|
||||
</td>
|
||||
<td>
|
||||
@item.Type
|
||||
</td>
|
||||
<td>
|
||||
<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>
|
||||
|
||||
@code
|
||||
{
|
||||
List<MachineViewModel> _machines;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_machines = await Service.GetAsync();
|
||||
}
|
||||
}
|
||||
@@ -182,4 +182,8 @@
|
||||
<value>Familias de máquinas</value>
|
||||
<comment>Machine families.</comment>
|
||||
</data>
|
||||
<data name="Machines" xml:space="preserve">
|
||||
<value>Máquinas</value>
|
||||
<comment>Machines.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -430,4 +430,20 @@
|
||||
<value>{0} con una capacidad norminal de {1}</value>
|
||||
<comment>{0} is storage type, {1} is nominal capacity number formatted with above bytes or bps prefixes</comment>
|
||||
</data>
|
||||
<data name="Type" xml:space="preserve">
|
||||
<value>Tipo</value>
|
||||
<comment>Type</comment>
|
||||
</data>
|
||||
<data name="Introduced" xml:space="preserve">
|
||||
<value>Introducida en</value>
|
||||
<comment>Introduced</comment>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Nombre</value>
|
||||
<comment>Name</comment>
|
||||
</data>
|
||||
<data name="Company" xml:space="preserve">
|
||||
<value>Compañía</value>
|
||||
<comment>Company</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Marechai.Database.Models;
|
||||
using Marechai.ViewModels;
|
||||
@@ -18,6 +19,14 @@ namespace Marechai.Services
|
||||
_l = localizer;
|
||||
}
|
||||
|
||||
public async Task<List<MachineViewModel>> GetAsync() =>
|
||||
await _context.Machines.OrderBy(m => m.Company.Name).ThenBy(m => m.Name).ThenBy(m => m.Family.Name).
|
||||
Select(m => new MachineViewModel
|
||||
{
|
||||
Id = m.Id, Company = m.Company.Name, Name = m.Name, Model = m.Model,
|
||||
Introduced = m.Introduced, Type = m.Type, Family = m.Family.Name
|
||||
}).ToListAsync();
|
||||
|
||||
public async Task<MachineViewModel> GetMachine(int id)
|
||||
{
|
||||
Machine machine = await _context.Machines.FindAsync(id);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Marechai.Database;
|
||||
|
||||
namespace Marechai.ViewModels
|
||||
{
|
||||
@@ -18,5 +19,10 @@ namespace Marechai.ViewModels
|
||||
public List<ProcessorViewModel> Processors { get; set; }
|
||||
public List<SoundSynthViewModel> SoundSynthesizers { get; set; }
|
||||
public List<StorageViewModel> Storage { get; set; }
|
||||
public string Company { get; set; }
|
||||
public MachineType Type { get; set; }
|
||||
public string Family { get; set; }
|
||||
public string IntroducedView =>
|
||||
Introduced?.Year == 1000 ? "Prototype" : Introduced?.ToShortDateString() ?? "Unknown";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user