Files
marechai/Marechai/Pages/Admin/Details/Gpu.razor

242 lines
9.0 KiB
Plaintext
Raw Normal View History

2020-05-25 22:57:03 +01:00
@{
/******************************************************************************
// MARECHAI: Master repository of computing history artifacts information
// ----------------------------------------------------------------------------
//
// Filename : Details.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ 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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2003-2020 Natalia Portillo
*******************************************************************************/
}
@page "/admin/gpus/details/{Id:int}"
2020-05-27 19:01:11 +01:00
@page "/admin/gpus/edit/{Id:int}"
2020-05-27 22:59:03 +01:00
@page "/admin/gpus/create"
2020-05-25 22:57:03 +01:00
@inherits OwningComponentBase<GpusService>
@inject IStringLocalizer<GpusService> L
@inject CompaniesService CompaniesService
2020-05-27 19:01:11 +01:00
@inject NavigationManager NavigationManager
2020-05-25 22:57:03 +01:00
@attribute [Authorize(Roles = "UberAdmin, Admin")]
<h3>@L["Graphical processing unit details"]</h3>
<hr />
@if (!_loaded)
{
<p align="center">@L["Loading..."]</p>
return;
}
<div>
2020-05-27 19:01:11 +01:00
@if (_editing || _model.CompanyId != null)
2020-05-25 22:57:03 +01:00
{
<Field>
<FieldLabel>@L["Company"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownCompany">@L["Unknown (company)"]</Check>
}
@if (!_editing ||
!_unknownCompany)
{
<Select Disabled="!_editing" TValue="int?" @bind-SelectedValue="@_model.CompanyId">
@foreach (var company in _companies)
{
<SelectItem TValue="int?" Value="@company.Id">@company.Name</SelectItem>
}
</Select>
}
2020-05-25 22:57:03 +01:00
</Field>
}
2020-05-27 19:01:11 +01:00
<Field>
<FieldLabel>@L["Name"]</FieldLabel>
<Validation Validator="@ValidateName">
<TextEdit Disabled="!_editing" @bind-Text="@_model.Name">
<Feedback>
<ValidationError>@L["Please enter a valid name."]</ValidationError>
</Feedback>
</TextEdit>
</Validation>
</Field>
@if (_editing || _model.ModelCode != null)
2020-05-25 22:57:03 +01:00
{
<Field>
<FieldLabel>@L["Model code"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownModelCode">@L["Unknown (model code)"]</Check>
}
@if (!_editing ||
!_unknownModelCode)
{
<Validation Validator="@ValidateModelCode">
<TextEdit Disabled="!_editing" @bind-Text="@_model.ModelCode">
<Feedback>
<ValidationError>@L["Please enter a valid model code."]</ValidationError>
</Feedback>
</TextEdit>
</Validation>
}
2020-05-25 22:57:03 +01:00
</Field>
}
2020-05-27 19:01:11 +01:00
@if (_editing || _model.Introduced.HasValue)
2020-05-25 22:57:03 +01:00
{
<Field>
<FieldLabel>@L["Introduced"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" Disabled="_prototype" @bind-Checked="@_unknownIntroduced">@L["Unknown (introduction date)"]</Check>
<Check TValue="bool" Disabled="_unknownIntroduced" @bind-Checked="@_prototype">@L["Prototype"]</Check>
}
@if (!_editing ||
(!_prototype && !_unknownIntroduced))
{
<Validation Validator="@ValidateIntroduced">
<DateEdit Disabled="!_editing" TValue="DateTime?" @bind-Date="@_model.Introduced">
<Feedback>
<ValidationError>@L["Please enter an introduction date."]</ValidationError>
</Feedback>
</DateEdit>
</Validation>
}
</Field>
2020-05-25 22:57:03 +01:00
}
2020-05-27 19:01:11 +01:00
@if (_editing || _model.Package != null)
2020-05-25 22:57:03 +01:00
{
<Field>
<FieldLabel>@L["Package"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownPackage">@L["Unknown (package)"]</Check>
}
@if (!_editing ||
!_unknownPackage)
{
<Validation Validator="@ValidatePackage">
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Package">
<Feedback>
<ValidationError>@L["Please enter a valid package."]</ValidationError>
</Feedback>
</TextEdit>
</Validation>
}
2020-05-25 22:57:03 +01:00
</Field>
}
2020-05-27 19:01:11 +01:00
@if (_editing || _model.Process != null)
2020-05-25 22:57:03 +01:00
{
<Field>
<FieldLabel>@L["Process"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownProcess">@L["Unknown (process)"]</Check>
}
@if (!_editing ||
!_unknownProcess)
{
<Validation Validator="@ValidateProcess">
<TextEdit ReadOnly="!_editing" @bind-Text="@_model.Process">
<Feedback>
<ValidationError>@L["Please enter a valid process."]</ValidationError>
</Feedback>
</TextEdit>
</Validation>
}
2020-05-25 22:57:03 +01:00
</Field>
}
2020-05-27 19:01:11 +01:00
@if (_editing || _model.ProcessNm.HasValue)
2020-05-25 22:57:03 +01:00
{
<Field>
2020-05-26 04:03:53 +01:00
<FieldLabel>@L["Process (nm)"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownProcessNm">@L["Unknown (process size)"]</Check>
}
@if (!_editing ||
!_unknownProcessNm)
{
<Validation Validator="@ValidateFloatBiggerThanOne">
<NumericEdit Disabled="!_editing" TValue="float?" Decimals="2" @bind-Value="@_model.ProcessNm">
<Feedback>
<ValidationError>@L["Please enter a valid process size in nanometers."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
}
2020-05-25 22:57:03 +01:00
</Field>
}
2020-05-27 19:01:11 +01:00
@if (_editing || _model.DieSize.HasValue)
2020-05-25 22:57:03 +01:00
{
<Field>
2020-05-26 04:03:53 +01:00
<FieldLabel>@L["Die size (mm²)"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownDieSize">@L["Unknown (die size)"]</Check>
}
@if (!_editing ||
!_unknownDieSize)
{
<Validation Validator="@ValidateFloatBiggerThanOne">
<NumericEdit Disabled="!_editing" TValue="float?" Decimals="2" @bind-Value="@_model.DieSize">
<Feedback>
<ValidationError>@L["Please enter a valid die size in square millimeters."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
}
2020-05-25 22:57:03 +01:00
</Field>
}
2020-05-27 19:01:11 +01:00
@if (_editing || _model.Transistors.HasValue)
2020-05-25 22:57:03 +01:00
{
<Field>
<FieldLabel>@L["Transistors"]</FieldLabel>
2020-05-27 19:01:11 +01:00
@if (_editing)
{
<Check TValue="bool" @bind-Checked="@_unknownTransistors">@L["Unknown (transistors)"]</Check>
}
@if (!_editing ||
!_unknownTransistors)
{
<Validation Validator="@ValidateLongBiggerThanZero">
<NumericEdit Disabled="!_editing" TValue="long?" Decimals="0" @bind-Value="@_model.Transistors">
<Feedback>
<ValidationError>@L["Please enter a valid number of transistors."]</ValidationError>
</Feedback>
</NumericEdit>
</Validation>
}
2020-05-25 22:57:03 +01:00
</Field>
}
</div>
<div>
2020-05-27 19:01:11 +01:00
@if (!_editing)
{
<Button Color="Color.Primary" Clicked="@OnEditClicked">@L["Edit"]</Button>
}
else
{
<Button Color="Color.Success" Clicked="@OnSaveClicked">@L["Save"]</Button>
<Button Color="Color.Danger" Clicked="@OnCancelClicked">@L["Cancel"]</Button>
}
<a href="/admin/gpus" class="btn btn-secondary">@L["Back to list"]</a>
2020-05-25 22:57:03 +01:00
</div>