fix(centralui): enable Test Bindings for MxGateway connections

The Test Bindings button was disabled (greyed out) for any attribute bound
to a non-OPC-UA connection. BuildTestableRows() filtered to protocol ==
"OpcUa", a stale gate left over from when OPC UA was the only protocol.
ReadTagValuesCommand is protocol-agnostic (routes through
IDataConnection.ReadBatchAsync, which MxGatewayDataConnection implements),
so the filter only blocked the UI — mirroring the already-fixed IsBrowsable.

Remove the OPC-UA-only filter and update the stale comments. Add a bUnit
regression test (theory over MxGateway + OpcUa) asserting the button is
enabled for a readable-protocol binding.

Verified live: dialog opens for an MxGateway binding and returns a
Good-quality read.
This commit is contained in:
Joseph Doherty
2026-05-29 12:26:46 -04:00
parent 4b6ff49822
commit 4881f9c23c
2 changed files with 72 additions and 9 deletions
@@ -158,9 +158,10 @@
<button class="btn btn-success btn-sm" @onclick="SaveBindings" disabled="@_saving">Save Bindings</button>
@* Test Bindings: one-shot live read of every bound attribute
whose row has a connection picked AND an effective tag
path. Disabled when no testable rows. Currently OPC UA
only — other protocols (none yet) would need their own
wire+adapter support to round-trip through ReadTagValuesCommand. *@
path. Disabled when no testable rows. Protocol-agnostic —
any connection whose adapter implements ReadBatchAsync
(OPC UA and MxGateway today) round-trips through
ReadTagValuesCommand. *@
<button class="btn btn-outline-primary btn-sm"
@onclick="OpenTestBindings"
disabled="@(!HasTestableBindings())">
@@ -612,8 +613,10 @@
/// <summary>
/// Builds the list of testable rows: attributes that have a connection
/// picked AND a non-empty effective tag path AND an OPC UA connection
/// (the only protocol routed through <c>ReadTagValuesCommand</c> today).
/// picked AND a non-empty effective tag path. Protocol-agnostic — every
/// data-connection adapter implements <c>ReadBatchAsync</c>, so the read
/// routes through <c>ReadTagValuesCommand</c> regardless of protocol
/// (OPC UA and MxGateway today).
/// </summary>
private List<TestBindingsDialog.BindingRowToTest> BuildTestableRows()
{
@@ -626,10 +629,11 @@
var conn = _siteConnections.FirstOrDefault(c => c.Id == connId);
if (conn is null) continue;
// OPC UA only — other protocols don't have a site-side
// ReadTagValuesCommand handler wired up yet.
if (!string.Equals(conn.Protocol, "OpcUa", StringComparison.OrdinalIgnoreCase))
continue;
// Protocol-agnostic: ReadTagValuesCommand routes through the
// site-side IDataConnection.ReadBatchAsync contract, which every
// adapter implements (OPC UA and MxGateway today). A not-connected
// or unsupported connection short-circuits to a typed banner in the
// dialog rather than being filtered out here — mirrors IsBrowsable.
var effectivePath = _bindingOverrides.GetValueOrDefault(attr.Name)
?? GetTemplateDefault(attr.Name);