mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Optimize view of GPUs by machine admin page.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Cicm.Database.Models;
|
using Cicm.Database.Models;
|
||||||
|
using cicm_web.Areas.Admin.Models;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
@@ -25,7 +26,11 @@ namespace cicm_web.Areas.Admin.Controllers
|
|||||||
{
|
{
|
||||||
IIncludableQueryable<GpusByMachine, Machine> cicmContext =
|
IIncludableQueryable<GpusByMachine, Machine> cicmContext =
|
||||||
_context.GpusByMachine.Include(g => g.Gpu).Include(g => g.Machine);
|
_context.GpusByMachine.Include(g => g.Gpu).Include(g => g.Machine);
|
||||||
return View(await cicmContext.OrderBy(g => g.Machine.Name).ThenBy(g => g.Gpu.Name).ToListAsync());
|
return View(await cicmContext.OrderBy(g => g.Machine.Name).ThenBy(g => g.Gpu.Name)
|
||||||
|
.Select(g => new GpusByMachineViewModel
|
||||||
|
{
|
||||||
|
Id = g.Id, Gpu = g.Gpu.Name, Machine = g.Machine.Name
|
||||||
|
}).ToListAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: GpusByMachine/Details/5
|
// GET: GpusByMachine/Details/5
|
||||||
|
|||||||
43
cicm_web/Areas/Admin/Models/GpusByMachineViewModel.cs
Normal file
43
cicm_web/Areas/Admin/Models/GpusByMachineViewModel.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
// Canary Islands Computer Museum Website
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : GpusByMachine.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Junction betweeen GPU and machine.
|
||||||
|
//
|
||||||
|
// --[ 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-2018 Natalia Portillo
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Cicm.Database.Models;
|
||||||
|
|
||||||
|
namespace cicm_web.Areas.Admin.Models
|
||||||
|
{
|
||||||
|
public class GpusByMachineViewModel : BaseModel<long>
|
||||||
|
{
|
||||||
|
[DisplayName("GPU")]
|
||||||
|
public string Gpu;
|
||||||
|
public long Id;
|
||||||
|
public string Machine;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
@model IEnumerable<Cicm.Database.Models.GpusByMachine>
|
@using cicm_web.Areas.Admin.Models
|
||||||
|
@model IEnumerable<cicm_web.Areas.Admin.Models.GpusByMachineViewModel>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Index";
|
ViewData["Title"] = "Index";
|
||||||
@@ -7,35 +8,51 @@
|
|||||||
<h1>GPUs by machine</h1>
|
<h1>GPUs by machine</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create" class="btn btn-primary">Create New</a>
|
<a asp-action="Create"
|
||||||
|
class="btn btn-primary">
|
||||||
|
Create New
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Machine)
|
@Html.DisplayNameFor(model => model.Machine)
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Gpu)
|
@Html.DisplayNameFor(model => model.Gpu)
|
||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var item in Model) {
|
@foreach(GpusByMachineViewModel item in Model)
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Machine.Name)
|
@Html.DisplayFor(modelItem => item.Machine)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Gpu.Name)
|
@Html.DisplayFor(modelItem => item.Gpu)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-primary">Details</a>
|
<a asp-action="Details"
|
||||||
<a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-secondary">Edit</a>
|
asp-route-id="@item.Id"
|
||||||
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
|
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>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -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.549</Version>
|
<Version>3.0.99.550</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user