refactor(browse): rename OPC-UA browse service + dialog to protocol-agnostic
IOpcUaBrowseService/OpcUaBrowseService -> IBrowseService/BrowseService, OpcUaBrowserDialog -> NodeBrowserDialog, and neutralize 'Browse OPC UA' UI strings to 'Browse'. Updates DI, InstanceConfigure, TestBindingsDialog, TreeRow, BindingTester, and tests. 574 CentralUI tests green.
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
@using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol
|
@using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol
|
||||||
@using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management
|
@using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management
|
||||||
@using ZB.MOM.WW.ScadaBridge.CentralUI.Services
|
@using ZB.MOM.WW.ScadaBridge.CentralUI.Services
|
||||||
@inject IOpcUaBrowseService BrowseService
|
@inject IBrowseService BrowseService
|
||||||
|
|
||||||
@if (_isVisible)
|
@if (_isVisible)
|
||||||
{
|
{
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">Browse OPC UA — @ConnectionName</h5>
|
<h5 class="modal-title">Browse — @ConnectionName</h5>
|
||||||
<button type="button" class="btn-close" @onclick="Cancel"></button>
|
<button type="button" class="btn-close" @onclick="Cancel"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the dialog and triggers an immediate one-shot read. Method-arg
|
/// Opens the dialog and triggers an immediate one-shot read. Method-arg
|
||||||
/// pattern (mirroring <c>OpcUaBrowserDialog.ShowAsync</c>) — Razor
|
/// pattern (mirroring <c>NodeBrowserDialog.ShowAsync</c>) — Razor
|
||||||
/// parameter binding would propagate on the next render and race the
|
/// parameter binding would propagate on the next render and race the
|
||||||
/// LoadAsync below.
|
/// LoadAsync below.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -46,8 +46,8 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public OpcUaBrowserDialog.TreeNode Node { get; set; } = default!;
|
[Parameter] public NodeBrowserDialog.TreeNode Node { get; set; } = default!;
|
||||||
[Parameter] public EventCallback<OpcUaBrowserDialog.TreeNode> OnToggle { get; set; }
|
[Parameter] public EventCallback<NodeBrowserDialog.TreeNode> OnToggle { get; set; }
|
||||||
[Parameter] public EventCallback<OpcUaBrowserDialog.TreeNode> OnSelect { get; set; }
|
[Parameter] public EventCallback<NodeBrowserDialog.TreeNode> OnSelect { get; set; }
|
||||||
[Parameter] public string? SelectedNodeId { get; set; }
|
[Parameter] public string? SelectedNodeId { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -144,7 +144,7 @@
|
|||||||
{
|
{
|
||||||
<button class="btn btn-sm btn-outline-primary"
|
<button class="btn btn-sm btn-outline-primary"
|
||||||
disabled="@(!canBrowse)"
|
disabled="@(!canBrowse)"
|
||||||
title="@(canBrowse ? "Browse OPC UA address space" : "Pick a connection first")"
|
title="@(canBrowse ? "Browse address space" : "Pick a connection first")"
|
||||||
@onclick="() => OpenBrowser(attr.Name)">
|
@onclick="() => OpenBrowser(attr.Name)">
|
||||||
Browse…
|
Browse…
|
||||||
</button>
|
</button>
|
||||||
@@ -367,7 +367,7 @@
|
|||||||
|
|
||||||
@* OPC UA Tag Browser dialog (Task 18) — rendered once; OpenBrowser
|
@* OPC UA Tag Browser dialog (Task 18) — rendered once; OpenBrowser
|
||||||
tracks which binding row's override input receives the picked node id. *@
|
tracks which binding row's override input receives the picked node id. *@
|
||||||
<OpcUaBrowserDialog @ref="_browserRef"
|
<NodeBrowserDialog @ref="_browserRef"
|
||||||
SiteId="@_browserSiteIdentifier"
|
SiteId="@_browserSiteIdentifier"
|
||||||
ConnectionName="@_browserConnectionName"
|
ConnectionName="@_browserConnectionName"
|
||||||
InitialNodeId="@_browserInitial"
|
InitialNodeId="@_browserInitial"
|
||||||
@@ -375,7 +375,7 @@
|
|||||||
|
|
||||||
@* Test Bindings dialog — one-shot live read of every bound attribute.
|
@* Test Bindings dialog — one-shot live read of every bound attribute.
|
||||||
Method-arg ShowAsync(siteId, rows) — no Razor parameter propagation
|
Method-arg ShowAsync(siteId, rows) — no Razor parameter propagation
|
||||||
race (same pattern as OpcUaBrowserDialog). *@
|
race (same pattern as NodeBrowserDialog). *@
|
||||||
<TestBindingsDialog @ref="_testBindingsRef" />
|
<TestBindingsDialog @ref="_testBindingsRef" />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -407,7 +407,7 @@
|
|||||||
|
|
||||||
// OPC UA tag browser (Task 18) — single dialog rendered at page bottom;
|
// OPC UA tag browser (Task 18) — single dialog rendered at page bottom;
|
||||||
// _browserAttrInEdit tracks which row gets the picked node id on Select.
|
// _browserAttrInEdit tracks which row gets the picked node id on Select.
|
||||||
private OpcUaBrowserDialog? _browserRef;
|
private NodeBrowserDialog? _browserRef;
|
||||||
private string? _browserAttrInEdit;
|
private string? _browserAttrInEdit;
|
||||||
private string _browserSiteIdentifier = "";
|
private string _browserSiteIdentifier = "";
|
||||||
private string _browserConnectionName = "";
|
private string _browserConnectionName = "";
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public static class ServiceCollectionExtensions
|
|||||||
// OPC UA Tag Browser (Task 14): facade over CommunicationService.BrowseNodeAsync
|
// OPC UA Tag Browser (Task 14): facade over CommunicationService.BrowseNodeAsync
|
||||||
// that enforces the CentralUI-side Design-role trust boundary and translates
|
// that enforces the CentralUI-side Design-role trust boundary and translates
|
||||||
// transport failures into typed BrowseFailure results for the dialog.
|
// transport failures into typed BrowseFailure results for the dialog.
|
||||||
services.AddScoped<IOpcUaBrowseService, OpcUaBrowseService>();
|
services.AddScoped<IBrowseService, BrowseService>();
|
||||||
|
|
||||||
// Test Bindings: facade over CommunicationService.ReadTagValuesAsync —
|
// Test Bindings: facade over CommunicationService.ReadTagValuesAsync —
|
||||||
// same Design-role guard + typed-failure translation as the browse
|
// same Design-role guard + typed-failure translation as the browse
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
|||||||
/// <see cref="CommunicationService.ReadTagValuesAsync"/> that enforces the
|
/// <see cref="CommunicationService.ReadTagValuesAsync"/> that enforces the
|
||||||
/// CentralUI-side <c>Design</c>-role trust boundary and translates transport
|
/// CentralUI-side <c>Design</c>-role trust boundary and translates transport
|
||||||
/// exceptions into a typed <see cref="ReadTagValuesFailure"/> result. Mirrors
|
/// exceptions into a typed <see cref="ReadTagValuesFailure"/> result. Mirrors
|
||||||
/// <see cref="OpcUaBrowseService"/>.
|
/// <see cref="BrowseService"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class BindingTester : IBindingTester
|
public sealed class BindingTester : IBindingTester
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-4
@@ -7,7 +7,7 @@ using ZB.MOM.WW.ScadaBridge.Security;
|
|||||||
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default <see cref="IOpcUaBrowseService"/> implementation — a thin facade over
|
/// Default <see cref="IBrowseService"/> implementation — a thin facade over
|
||||||
/// <see cref="CommunicationService.BrowseNodeAsync"/> that enforces the
|
/// <see cref="CommunicationService.BrowseNodeAsync"/> that enforces the
|
||||||
/// CentralUI-side <c>Design</c>-role trust boundary and translates transport
|
/// CentralUI-side <c>Design</c>-role trust boundary and translates transport
|
||||||
/// exceptions into a typed <see cref="BrowseFailure"/> result.
|
/// exceptions into a typed <see cref="BrowseFailure"/> result.
|
||||||
@@ -19,17 +19,17 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
|||||||
/// <c>ServerError</c> so the dialog can show an inline banner while leaving the
|
/// <c>ServerError</c> so the dialog can show an inline banner while leaving the
|
||||||
/// manual node-id paste field usable.
|
/// manual node-id paste field usable.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public sealed class OpcUaBrowseService : IOpcUaBrowseService
|
public sealed class BrowseService : IBrowseService
|
||||||
{
|
{
|
||||||
private readonly CommunicationService _communication;
|
private readonly CommunicationService _communication;
|
||||||
private readonly AuthenticationStateProvider _auth;
|
private readonly AuthenticationStateProvider _auth;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="OpcUaBrowseService"/>.
|
/// Initializes a new instance of the <see cref="BrowseService"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="communication">Central-side cluster communication service.</param>
|
/// <param name="communication">Central-side cluster communication service.</param>
|
||||||
/// <param name="auth">Authentication state provider used for the Design-role guard.</param>
|
/// <param name="auth">Authentication state provider used for the Design-role guard.</param>
|
||||||
public OpcUaBrowseService(CommunicationService communication, AuthenticationStateProvider auth)
|
public BrowseService(CommunicationService communication, AuthenticationStateProvider auth)
|
||||||
{
|
{
|
||||||
_communication = communication ?? throw new ArgumentNullException(nameof(communication));
|
_communication = communication ?? throw new ArgumentNullException(nameof(communication));
|
||||||
_auth = auth ?? throw new ArgumentNullException(nameof(auth));
|
_auth = auth ?? throw new ArgumentNullException(nameof(auth));
|
||||||
@@ -16,7 +16,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
|||||||
/// envelope. Transport failures (timeouts, unreachable sites) are translated
|
/// envelope. Transport failures (timeouts, unreachable sites) are translated
|
||||||
/// into a typed <see cref="ReadTagValuesFailure"/> so the dialog can render an
|
/// into a typed <see cref="ReadTagValuesFailure"/> so the dialog can render an
|
||||||
/// inline banner without crashing — same shape as
|
/// inline banner without crashing — same shape as
|
||||||
/// <see cref="IOpcUaBrowseService"/>.
|
/// <see cref="IBrowseService"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IBindingTester
|
public interface IBindingTester
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
|
|||||||
/// <see cref="BrowseFailure"/> so the dialog can render an inline error and
|
/// <see cref="BrowseFailure"/> so the dialog can render an inline error and
|
||||||
/// remain usable (manual node-id paste still works).
|
/// remain usable (manual node-id paste still works).
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IOpcUaBrowseService
|
public interface IBrowseService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enumerates the immediate children of an OPC UA node on the live server
|
/// Enumerates the immediate children of an OPC UA node on the live server
|
||||||
+2
-2
@@ -44,10 +44,10 @@ public class InstanceConfigureAuditDrillinTests : BunitContext
|
|||||||
Services.AddSingleton(new InstanceService(_templateRepo, Substitute.For<IAuditService>()));
|
Services.AddSingleton(new InstanceService(_templateRepo, Substitute.For<IAuditService>()));
|
||||||
Services.AddSingleton(Substitute.For<IFlatteningPipeline>());
|
Services.AddSingleton(Substitute.For<IFlatteningPipeline>());
|
||||||
|
|
||||||
// The page renders <OpcUaBrowserDialog/> and <TestBindingsDialog/> at
|
// The page renders <NodeBrowserDialog/> and <TestBindingsDialog/> at
|
||||||
// the bottom; their @inject directives need a registered service even
|
// the bottom; their @inject directives need a registered service even
|
||||||
// though this test doesn't open either dialog.
|
// though this test doesn't open either dialog.
|
||||||
Services.AddSingleton(Substitute.For<IOpcUaBrowseService>());
|
Services.AddSingleton(Substitute.For<IBrowseService>());
|
||||||
Services.AddSingleton(Substitute.For<IBindingTester>());
|
Services.AddSingleton(Substitute.For<IBindingTester>());
|
||||||
|
|
||||||
// Auth: a system-wide Deployment user so SiteScope grants everything.
|
// Auth: a system-wide Deployment user so SiteScope grants everything.
|
||||||
|
|||||||
Reference in New Issue
Block a user