feat(central-ui): tag selector + data-type auto-fill on Secured Writes
This commit is contained in:
+34
-2
@@ -5,6 +5,8 @@
|
||||
@using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories
|
||||
@using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management
|
||||
@using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums
|
||||
@using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Dialogs
|
||||
@using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol
|
||||
@using ZB.MOM.WW.ScadaBridge.Security
|
||||
@inject ISecuredWriteService SecuredWriteSvc
|
||||
@inject ISiteRepository SiteRepository
|
||||
@@ -58,8 +60,14 @@
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label form-label-sm">Tag path</label>
|
||||
<input class="form-control form-control-sm" @bind="_formTagPath"
|
||||
placeholder="e.g. PLC1.Pump.Setpoint" data-test="secured-write-tagpath" />
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control form-control-sm" @bind="_formTagPath"
|
||||
placeholder="e.g. PLC1.Pump.Setpoint" data-test="secured-write-tagpath" />
|
||||
<button class="btn btn-outline-secondary" type="button"
|
||||
disabled="@(!CanBrowse)"
|
||||
title="@(CanBrowse ? "Browse tags" : "Pick a site and MxGateway connection first")"
|
||||
@onclick="OpenBrowser" data-test="secured-write-browse">Browse…</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label form-label-sm">Value</label>
|
||||
@@ -89,6 +97,11 @@
|
||||
Submit for verification
|
||||
</button>
|
||||
</div>
|
||||
<NodeBrowserDialog @ref="_browserRef"
|
||||
SiteId="@_formSiteIdentifier"
|
||||
ConnectionName="@_formConnectionName"
|
||||
ShowSearch="false"
|
||||
OnNodeSelected="OnTagPicked" />
|
||||
</div>
|
||||
</div>
|
||||
</Authorized>
|
||||
@@ -226,6 +239,25 @@
|
||||
private string _formValueType = nameof(DataType.Boolean);
|
||||
private string _formComment = "";
|
||||
|
||||
private NodeBrowserDialog? _browserRef;
|
||||
|
||||
private bool CanBrowse =>
|
||||
!string.IsNullOrWhiteSpace(_formSiteIdentifier)
|
||||
&& !string.IsNullOrWhiteSpace(_formConnectionName);
|
||||
|
||||
private async Task OpenBrowser()
|
||||
{
|
||||
if (!CanBrowse || _browserRef is null) return;
|
||||
await _browserRef.ShowAsync(_formSiteIdentifier, _formConnectionName, _formTagPath);
|
||||
}
|
||||
|
||||
private void OnTagPicked(BrowseNode node)
|
||||
{
|
||||
_formTagPath = node.NodeId;
|
||||
if (SecuredWriteDataTypeMapper.TryMap(node.DataType, out var dt))
|
||||
_formValueType = dt.ToString();
|
||||
}
|
||||
|
||||
private bool _submitting;
|
||||
private bool _actionInProgress;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user