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">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
<Content Update="Pages\Admin\Details\InstructionSet.razor">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_ContentIncludedByDefault Remove="Areas\Admin\Views\BrowserTests\Delete.cshtml" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@{
|
||||
@{
|
||||
/******************************************************************************
|
||||
// MARECHAI: Master repository of computing history artifacts information
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -29,25 +29,28 @@
|
||||
// Copyright © 2003-2020 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
}
|
||||
@model Marechai.Database.Models.InstructionSet
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
<h2>Details</h2>
|
||||
<div>
|
||||
<h4>Instruction set</h4>
|
||||
@page "/admin/instruction_sets/details/{Id:int}"
|
||||
@inherits OwningComponentBase<InstructionSetsService>
|
||||
@inject IStringLocalizer<InstructionSetsService> L
|
||||
@attribute [Authorize(Roles = "UberAdmin, Admin")]
|
||||
<h3>@L["Instruction set details"]</h3>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@if (!_loaded)
|
||||
{
|
||||
<p align="center">@L["Loading..."]</p>
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
<div>
|
||||
<Field>
|
||||
<FieldLabel>@L["Name"]</FieldLabel>
|
||||
<TextEdit ReadOnly="!_editable" @bind-Text="@_model.Name"/>
|
||||
</Field>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-primary">Edit</a>
|
||||
<a asp-action="Index" class="btn btn-secondary">Back to List</a>
|
||||
<span class="btn btn-primary">@L["Edit"]</span>
|
||||
<a href="/admin/instruction_sets" class="btn btn-secondary">@L["Back to list"]</a>
|
||||
</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
|
||||
</td>
|
||||
<td>
|
||||
<span class="btn btn-primary">
|
||||
@L["Details"]
|
||||
</span>
|
||||
<a class="btn btn-primary" href="/admin/instruction_sets/details/@item.Id">@L["Details"]</a>
|
||||
<span class="btn btn-secondary">
|
||||
@L["Edit"]
|
||||
</span>
|
||||
|
||||
@@ -158,4 +158,12 @@
|
||||
<value>Cancelar</value>
|
||||
<comment>Cancel</comment>
|
||||
</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>
|
||||
@@ -15,6 +15,8 @@ namespace Marechai.Services
|
||||
public async Task<List<InstructionSet>> GetAsync() =>
|
||||
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)
|
||||
{
|
||||
InstructionSet item = await _context.InstructionSets.FindAsync(id);
|
||||
|
||||
Reference in New Issue
Block a user