Files
BQP/srcs/RobotNet10/FleetManager/RobotNet10.FleetManager.Client/Components/RobotDetail/InformationCard.razor
2026-07-13 09:25:40 +07:00

69 lines
2.4 KiB
Plaintext

@using RobotNet.VDA5050.State
@using RobotNet.VDA5050.Type
<MudPaper Class="pa-4" Elevation="2">
<MudText Typo="Typo.h6" Class="mb-3">Information</MudText>
@if (Info != null && Info.Length > 0)
{
<MudTable Items="@Info" T="Information" Hover="true" Dense="true" Height="400px" FixedHeader="true" Elevation="0">
<HeaderContent>
<MudTh>Info Type</MudTh>
<MudTh>Level</MudTh>
<MudTh>Description</MudTh>
<MudTh>References</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Info Type">@context.InfoType</MudTd>
<MudTd DataLabel="Level">
<MudChip T="string"
Size="Size.Small"
Color="@GetInfoLevelColor(context.InfoLevel)">
@context.InfoLevel
</MudChip>
</MudTd>
<MudTd DataLabel="Description">
<MudText Typo="Typo.body2" Style="max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
@(context.InfoDescription ?? "N/A")
</MudText>
</MudTd>
<MudTd DataLabel="References">
@if (context.InfoReferences != null && context.InfoReferences.Length > 0)
{
<MudChip T="string" Size="Size.Small" Color="Color.Info">
@context.InfoReferences.Length reference(s)
</MudChip>
}
else
{
<MudText Typo="Typo.body2">N/A</MudText>
}
</MudTd>
</RowTemplate>
</MudTable>
}
else
{
<MudText Typo="Typo.body2" Align="Align.Center">No information available</MudText>
}
</MudPaper>
@code {
private Information[]? Info { get; set; }
private Color GetInfoLevelColor(InfoLevel level)
{
return level switch
{
InfoLevel.INFO => Color.Info,
InfoLevel.DEBUG => Color.Default,
_ => Color.Default
};
}
public void Update(Information[]? info)
{
Info = info;
StateHasChanged();
}
}