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:
+15
-9
@@ -118,7 +118,7 @@
|
||||
{
|
||||
var connId = GetBindingConnectionId(attr.Name);
|
||||
var canBrowse = connId > 0;
|
||||
var isOpcUa = IsOpcUa(connId);
|
||||
var isBrowsable = IsBrowsable(connId);
|
||||
<tr>
|
||||
<td class="small">@attr.Name</td>
|
||||
<td class="small text-muted font-monospace">@attr.DataSourceReference</td>
|
||||
@@ -140,7 +140,7 @@
|
||||
placeholder="@(attr.DataSourceReference ?? "(no default)")" />
|
||||
</td>
|
||||
<td>
|
||||
@if (isOpcUa)
|
||||
@if (isBrowsable)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-primary"
|
||||
disabled="@(!canBrowse)"
|
||||
@@ -566,13 +566,19 @@
|
||||
private string? GetTemplateDefault(string attrName)
|
||||
=> _bindingDataSourceAttrs.FirstOrDefault(a => a.Name == attrName)?.DataSourceReference;
|
||||
|
||||
/// <summary>True when the row's selected data connection is OPC UA.</summary>
|
||||
private bool IsOpcUa(int connectionId)
|
||||
=> connectionId > 0
|
||||
&& string.Equals(
|
||||
_siteConnections.FirstOrDefault(c => c.Id == connectionId)?.Protocol,
|
||||
"OpcUa",
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
/// <summary>
|
||||
/// True when the row's selected data connection supports address-space browsing
|
||||
/// (the tag picker). OPC UA and MxGateway both implement
|
||||
/// <c>IBrowsableDataConnection</c> site-side; other protocols return a
|
||||
/// NotBrowsable failure, so the button is hidden for them.
|
||||
/// </summary>
|
||||
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>
|
||||
/// Opens the OPC UA tag browser dialog for the given attribute row. Remembers
|
||||
|
||||
Reference in New Issue
Block a user