feat(central-ui): MES badge on live alarm rows and template native-source list (ScadaBridge#102 item 3)
Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -1013,6 +1013,10 @@
|
||||
{
|
||||
<span class="badge bg-light text-dark" aria-label="Unlocked">Unlocked</span>
|
||||
}
|
||||
@if (src.IsMesReportable)
|
||||
{
|
||||
<span class="badge bg-success ms-1" data-test="native-mes-badge" aria-label="MES reportable">MES</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<span class="badge bg-info text-dark me-1" aria-label="Suppressed">Suppressed</span>
|
||||
}
|
||||
}
|
||||
@if (Alarm.IsMesReportable)
|
||||
{
|
||||
<span class="badge bg-success me-1" data-test="alarm-mes-badge"
|
||||
title="Reported by the MES alarm-status API" aria-label="MES reportable">MES</span>
|
||||
}
|
||||
<span class="font-monospace small text-muted me-1"
|
||||
aria-label="@($"Severity: {Alarm.Condition.Severity}")">sev @Alarm.Condition.Severity</span>
|
||||
@if (Alarm.Level != AlarmLevel.None)
|
||||
|
||||
@@ -56,4 +56,24 @@ public class AlarmStateBadgesTests : BunitContext
|
||||
// HiLo level badge label.
|
||||
Assert.Contains("Hi", cut.Markup);
|
||||
}
|
||||
|
||||
/// <summary>Gitea #102: a MES-reportable alarm shows the MES badge.</summary>
|
||||
[Fact]
|
||||
public void MesReportableAlarm_RendersMesBadge()
|
||||
{
|
||||
var alarm = ActiveNativeHighUnacked() with { IsMesReportable = true };
|
||||
|
||||
var cut = Render<AlarmStateBadges>(p => p.Add(c => c.Alarm, alarm));
|
||||
|
||||
Assert.Equal("MES", cut.Find("[data-test='alarm-mes-badge']").TextContent);
|
||||
}
|
||||
|
||||
/// <summary>Gitea #102: a non-reportable alarm shows no MES badge.</summary>
|
||||
[Fact]
|
||||
public void NonMesReportableAlarm_RendersNoMesBadge()
|
||||
{
|
||||
var cut = Render<AlarmStateBadges>(p => p.Add(c => c.Alarm, ActiveNativeHighUnacked()));
|
||||
|
||||
Assert.Empty(cut.FindAll("[data-test='alarm-mes-badge']"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user