feat(centralui): enable tag picker for MxGateway connections

Generalize the browse-button gate from IsOpcUa to IsBrowsable (OPC UA or
MxGateway, both implement IBrowsableDataConnection site-side). The generalized
NodeBrowserDialog + BrowseNodeCommand path already routes by protocol; non-
browsable protocols return NotBrowsable. Test Bindings stays OPC-UA-only (its
read path is out of this slice's scope).
This commit is contained in:
Joseph Doherty
2026-05-29 08:03:59 -04:00
parent be32e4a7ff
commit 569edf2975
@@ -118,7 +118,7 @@
{ {
var connId = GetBindingConnectionId(attr.Name); var connId = GetBindingConnectionId(attr.Name);
var canBrowse = connId > 0; var canBrowse = connId > 0;
var isOpcUa = IsOpcUa(connId); var isBrowsable = IsBrowsable(connId);
<tr> <tr>
<td class="small">@attr.Name</td> <td class="small">@attr.Name</td>
<td class="small text-muted font-monospace">@attr.DataSourceReference</td> <td class="small text-muted font-monospace">@attr.DataSourceReference</td>
@@ -140,7 +140,7 @@
placeholder="@(attr.DataSourceReference ?? "(no default)")" /> placeholder="@(attr.DataSourceReference ?? "(no default)")" />
</td> </td>
<td> <td>
@if (isOpcUa) @if (isBrowsable)
{ {
<button class="btn btn-sm btn-outline-primary" <button class="btn btn-sm btn-outline-primary"
disabled="@(!canBrowse)" disabled="@(!canBrowse)"
@@ -566,13 +566,19 @@
private string? GetTemplateDefault(string attrName) private string? GetTemplateDefault(string attrName)
=> _bindingDataSourceAttrs.FirstOrDefault(a => a.Name == attrName)?.DataSourceReference; => _bindingDataSourceAttrs.FirstOrDefault(a => a.Name == attrName)?.DataSourceReference;
/// <summary>True when the row's selected data connection is OPC UA.</summary> /// <summary>
private bool IsOpcUa(int connectionId) /// True when the row's selected data connection supports address-space browsing
=> connectionId > 0 /// (the tag picker). OPC UA and MxGateway both implement
&& string.Equals( /// <c>IBrowsableDataConnection</c> site-side; other protocols return a
_siteConnections.FirstOrDefault(c => c.Id == connectionId)?.Protocol, /// NotBrowsable failure, so the button is hidden for them.
"OpcUa", /// </summary>
StringComparison.OrdinalIgnoreCase); private bool IsBrowsable(int connectionId)
{
if (connectionId <= 0) return false;
var protocol = _siteConnections.FirstOrDefault(c => c.Id == connectionId)?.Protocol;
return string.Equals(protocol, "OpcUa", StringComparison.OrdinalIgnoreCase)
|| string.Equals(protocol, "MxGateway", StringComparison.OrdinalIgnoreCase);
}
/// <summary> /// <summary>
/// Opens the OPC UA tag browser dialog for the given attribute row. Remembers /// Opens the OPC UA tag browser dialog for the given attribute row. Remembers