mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add instruction set details in admin view.
This commit is contained in:
@@ -97,6 +97,9 @@
|
|||||||
<Content Update="Pages\Admin\Details\InstructionSetExtension.razor">
|
<Content Update="Pages\Admin\Details\InstructionSetExtension.razor">
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Update="Pages\Admin\Details\InstructionSet.razor">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@{
|
@{
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
// MARECHAI: Master repository of computing history artifacts information
|
// MARECHAI: Master repository of computing history artifacts information
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
@@ -29,25 +29,28 @@
|
|||||||
// Copyright © 2003-2020 Natalia Portillo
|
// Copyright © 2003-2020 Natalia Portillo
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
}
|
}
|
||||||
@model Marechai.Database.Models.InstructionSet
|
|
||||||
|
|
||||||
@{
|
@page "/admin/instruction_sets/details/{Id:int}"
|
||||||
ViewData["Title"] = "Details";
|
@inherits OwningComponentBase<InstructionSetsService>
|
||||||
|
@inject IStringLocalizer<InstructionSetsService> L
|
||||||
|
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||||
|
<h3>@L["Instruction set details"]</h3>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
@if (!_loaded)
|
||||||
|
{
|
||||||
|
<p align="center">@L["Loading..."]</p>
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
<h2>Details</h2>
|
|
||||||
<div>
|
<div>
|
||||||
<h4>Instruction set</h4>
|
<Field>
|
||||||
<hr />
|
<FieldLabel>@L["Name"]</FieldLabel>
|
||||||
<dl class="dl-horizontal">
|
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name"/>
|
||||||
<dt>
|
</Field>
|
||||||
@Html.DisplayNameFor(model => model.Name)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Name)
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">Edit</a>
|
<span class="btn btn-primary">@L["Edit"]</span>
|
||||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
<a href="/admin/instruction_sets" class="btn btn-secondary">@L["Back to list"]</a>
|
||||||
</div>
|
</div>
|
||||||
29
Marechai/Pages/Admin/Details/InstructionSet.razor.cs
Normal file
29
Marechai/Pages/Admin/Details/InstructionSet.razor.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace Marechai.Pages.Admin.Details
|
||||||
|
{
|
||||||
|
public partial class InstructionSet
|
||||||
|
{
|
||||||
|
bool _editable;
|
||||||
|
bool _loaded;
|
||||||
|
Database.Models.InstructionSet _model;
|
||||||
|
[Parameter]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if(_loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_loaded = true;
|
||||||
|
|
||||||
|
if(Id <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_model = await Service.GetAsync(Id);
|
||||||
|
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,9 +63,7 @@
|
|||||||
@item.Name
|
@item.Name
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="btn btn-primary">
|
<a class="btn btn-primary" href="/admin/instruction_sets/details/@item.Id">@L["Details"]</a>
|
||||||
@L["Details"]
|
|
||||||
</span>
|
|
||||||
<span class="btn btn-secondary">
|
<span class="btn btn-secondary">
|
||||||
@L["Edit"]
|
@L["Edit"]
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -158,4 +158,12 @@
|
|||||||
<value>Cancelar</value>
|
<value>Cancelar</value>
|
||||||
<comment>Cancel</comment>
|
<comment>Cancel</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Instruction set details" xml:space="preserve">
|
||||||
|
<value>Detalles de arquitectura</value>
|
||||||
|
<comment>Instruction set details</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Back to list" xml:space="preserve">
|
||||||
|
<value>Volver a la lista</value>
|
||||||
|
<comment>Back to list</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -15,6 +15,8 @@ namespace Marechai.Services
|
|||||||
public async Task<List<InstructionSet>> GetAsync() =>
|
public async Task<List<InstructionSet>> GetAsync() =>
|
||||||
await _context.InstructionSets.OrderBy(s => s.Name).ToListAsync();
|
await _context.InstructionSets.OrderBy(s => s.Name).ToListAsync();
|
||||||
|
|
||||||
|
public async Task<InstructionSet> GetAsync(int id) => await _context.InstructionSets.FindAsync(id);
|
||||||
|
|
||||||
public async Task DeleteAsync(int id)
|
public async Task DeleteAsync(int id)
|
||||||
{
|
{
|
||||||
InstructionSet item = await _context.InstructionSets.FindAsync(id);
|
InstructionSet item = await _context.InstructionSets.FindAsync(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user