Files
Denso/srcs/RobotNet10/FleetManager/RobotNet10.FleetManager.Client/Components/RobotDetail/ActionStatesCard.razor
2026-07-03 16:31:37 +07:00

70 lines
2.6 KiB
Plaintext

@using RobotNet.VDA5050.State
@using RobotNet.VDA5050.Type
<MudPaper Class="pa-4" Elevation="2">
<MudText Typo="Typo.h6" Class="mb-3">Action States</MudText>
@if (State?.ActionStates != null && State.ActionStates.Length > 0)
{
<MudTable Items="@State.ActionStates" T="ActionState" Hover="true" Dense="true" Height="400px" FixedHeader="true" Elevation="0">
<HeaderContent>
<MudTh>Action ID</MudTh>
<MudTh>Action Type</MudTh>
<MudTh>Status</MudTh>
<MudTh>Description</MudTh>
<MudTh>Result</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="Action ID">
<MudText Typo="Typo.body2" Style="max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
@context.ActionId
</MudText>
</MudTd>
<MudTd DataLabel="Action Type">@(context.ActionType ?? "N/A")</MudTd>
<MudTd DataLabel="Status">
<MudChip T="string"
Size="Size.Small"
Color="@GetActionStatusColor(context.ActionStatus)">
@context.ActionStatus
</MudChip>
</MudTd>
<MudTd DataLabel="Description">
<MudText Typo="Typo.body2" Style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
@(context.ActionDescription ?? "N/A")
</MudText>
</MudTd>
<MudTd DataLabel="Result">
<MudText Typo="Typo.body2" Style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
@(context.ResultDescription ?? "N/A")
</MudText>
</MudTd>
</RowTemplate>
</MudTable>
}
else
{
<MudText Typo="Typo.body2" Align="Align.Center">No action states available</MudText>
}
</MudPaper>
@code {
public StateMsg? State { get; set; }
private Color GetActionStatusColor(ActionStatus status)
{
return status switch
{
ActionStatus.WAITING => Color.Default,
ActionStatus.RUNNING => Color.Info,
ActionStatus.FINISHED => Color.Success,
ActionStatus.FAILED => Color.Error,
_ => Color.Default
};
}
public void Update(StateMsg? state)
{
State = state;
StateHasChanged();
}
}