feat(dashboard): distinct 'forced' subtag provider badge

Render Fallback:Mode=ForceSubtag as a cyan 'Subtag monitoring (forced)'
badge, distinct from the amber failover 'degraded' badge, so an intentional
configuration isn't shown as a fault. Distinguished by the shared
AlarmProviderReasons.ForcedSubtag reason carried on the provider-status feed.
This commit is contained in:
Joseph Doherty
2026-06-15 01:43:17 -04:00
parent b40aaeef05
commit 410acc92eb
5 changed files with 73 additions and 6 deletions
@@ -172,6 +172,28 @@ public sealed class DashboardBrowseAndAlarmModelTests
Assert.Equal("x", model.Reason);
}
/// <summary>
/// Verifies that a configured forced-subtag provider status renders the
/// distinct "forced" badge (cyan/info), not the amber failover-degraded one.
/// </summary>
[Fact]
public void FromProviderStatus_Subtag_ForcedReason_ForcedBadge()
{
AlarmProviderStatus status = new()
{
Mode = AlarmProviderMode.Subtag,
Degraded = true,
Reason = ZB.MOM.WW.MxGateway.Server.Alarms.AlarmProviderReasons.ForcedSubtag,
};
DashboardAlarmProviderStatus model = DashboardAlarmProviderStatus.FromProviderStatus(status);
Assert.True(model.IsDegraded);
Assert.Equal(DashboardAlarmProviderStatus.ForcedSubtagLabel, model.Label);
Assert.Contains("bg-info", model.BadgeCssClass, StringComparison.Ordinal);
Assert.DoesNotContain("bg-warning", model.BadgeCssClass, StringComparison.Ordinal);
}
/// <summary>Verifies that the formatter renders array elements and element type correctly.</summary>
[Fact]
public void FormatValue_AndDataType_RenderArrayElementsAndElementType()