87 lines
4.2 KiB
Plaintext
87 lines
4.2 KiB
Plaintext
@implements IAsyncDisposable
|
|
|
|
<div class="ias-3col">
|
|
@RobotRow("IMR", State.Imr)
|
|
@RobotRow("AMR", State.Amr)
|
|
<div class="ias-row">
|
|
<MudChip T="string" Size="Size.Small" Color="@(!State.Asrs.IsOffline ? Color.Success : Color.Default)"
|
|
Variant="Variant.Text" Style="height:22px;font-size:11px;margin:0;flex-shrink:0;">ASRS</MudChip>
|
|
<MudChip T="string" Size="Size.Small"
|
|
Color="@(State.Asrs.SAFETY_MODE == true ? Color.Success : Color.Default)"
|
|
Variant="@(State.Asrs.SAFETY_MODE == true ? Variant.Filled : Variant.Outlined)"
|
|
Style="height:22px;font-size:11px;margin:0;flex-shrink:0;">Safety</MudChip>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
[Inject] StateService State { get; set; } = default!;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await State.StartAsync();
|
|
State.ImrChanged += Refresh;
|
|
State.AmrChanged += Refresh;
|
|
State.AsrsChanged += Refresh;
|
|
State.WorkflowChanged += Refresh;
|
|
}
|
|
|
|
public ValueTask DisposeAsync()
|
|
{
|
|
State.ImrChanged -= Refresh;
|
|
State.AmrChanged -= Refresh;
|
|
State.AsrsChanged -= Refresh;
|
|
State.WorkflowChanged -= Refresh;
|
|
return ValueTask.CompletedTask;
|
|
}
|
|
|
|
private void Refresh() => InvokeAsync(StateHasChanged);
|
|
|
|
private RenderFragment RobotRow(string label, RobotStateDto s) => __builder =>
|
|
{
|
|
bool online = s.IsOnline;
|
|
bool ready = s.NewBaseRequest == true;
|
|
<div class="ias-row">
|
|
<MudChip T="string" Size="Size.Small" Color="@(online ? Color.Success : Color.Default)"
|
|
Variant="Variant.Text" Style="height:22px;font-size:11px;margin:0;flex-shrink:0;">@label</MudChip>
|
|
<MudChip T="string" Size="Size.Small"
|
|
Color="@(ready ? Color.Success : Color.Default)"
|
|
Variant="@(ready ? Variant.Filled : Variant.Outlined)"
|
|
Style="height:22px;font-size:11px;margin:0;flex-shrink:0;">NBR</MudChip>
|
|
<span class="@(online ? "ias-pos" : "ias-pos ias-dim")">@($"{s.X:F1}, {s.Y:F1}")</span>
|
|
@foreach (var a in s.Actions.Take(2))
|
|
{
|
|
string acls = a.ActionStatus switch {
|
|
"RUNNING" => "ias-act-run",
|
|
"WAITING" or "INITIALIZING" => "ias-act-wait",
|
|
"FINISHED" => "ias-act-done",
|
|
"FAILED" or "ABORTED" => "ias-act-fail",
|
|
_ => "ias-act-idle"
|
|
};
|
|
string aname = string.Equals(a.ActionID, "UndockFromStation", StringComparison.OrdinalIgnoreCase)
|
|
? "Undock" : (a.ActionID ?? "?");
|
|
<span class="ias-act @acls">@aname</span>
|
|
}
|
|
@if (s.Errors.Any())
|
|
{
|
|
<span class="ias-err">
|
|
<MudIcon Icon="@Icons.Material.Filled.Warning" Size="Size.Small" /> @string.Join(", ", s.Errors)
|
|
</span>
|
|
}
|
|
</div>
|
|
};
|
|
}
|
|
|
|
<style>
|
|
.ias-3col { display:grid; grid-template-columns:1fr 1fr auto; gap:4px 8px; align-items:center; }
|
|
.ias-row { display:flex; gap:4px; align-items:center; flex-wrap:nowrap; overflow:hidden; min-width:0; }
|
|
.ias-pos { font-size:11px; color:#F1F5F9; font-variant-numeric:tabular-nums; white-space:nowrap; flex-shrink:0; }
|
|
.ias-dim { color:#9CA3AF; }
|
|
.ias-act { font-size:10px; font-weight:600; padding:1px 5px; border-radius:4px; border:1px solid; white-space:nowrap; flex-shrink:0; }
|
|
.ias-act-run { color:#4a9eff; border-color:rgba(74,158,255,0.5); background:rgba(74,158,255,0.08); }
|
|
.ias-act-wait { color:#f39c12; border-color:rgba(243,156,18,0.45); background:rgba(243,156,18,0.06); }
|
|
.ias-act-done { color:#2ecc71; border-color:rgba(46,204,113,0.25); background:transparent; }
|
|
.ias-act-fail { color:#e74c3c; border-color:rgba(231,76,60,0.45); background:rgba(231,76,60,0.07); }
|
|
.ias-act-idle { color:#9CA3AF; border-color:#1c1c1c; background:transparent; }
|
|
.ias-err { font-size:10px; color:#e74c3c; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
</style>
|