namespace ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers.Forms; /// /// The rule deciding which primary-host advisory MqttDriverForm shows when /// Act as Primary Host is on. /// /// /// /// A plain static rather than markup logic, because this repo has no bUnit. A condition /// written inline in a .razor file is unreachable from any test, and the failure mode /// here is specific: an operator who ticks the box with a blank host id must see a /// refusal, not the ordinary "here is what will happen" note. Getting that backwards /// tells them a claim is being made when the driver is in fact declining to make one. /// /// /// Deliberately mirrors SparkplugPrimaryHost.DescribeUnusable's blank-host-id arm. The /// mode arm is not duplicated: this panel only renders inside the SparkplugB branch of the /// form, so mode cannot be wrong here. /// /// public static class SparkplugPrimaryHostAdvice { /// /// Describes why a primary-host claim cannot be made for , or /// when it can. /// /// The Sparkplug host id as typed into the form. /// An operator-facing reason, or . public static string? DescribeBlockingProblem(string? hostId) => string.IsNullOrWhiteSpace(hostId) ? "A Sparkplug host claim is published on spBv1.0/STATE/{hostId}, so it needs a Host ID. " + "Set one above, or turn this off — the driver will otherwise log a warning at startup " + "and publish nothing." : null; }