feat(adminui): typed TagConfig editors for OpcUaClient + Historian
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
@using ZB.MOM.WW.OtOpcUa.AdminUI.Uns.TagEditors
|
||||
|
||||
<div class="row g-2">
|
||||
<div class="col-md-12"><label class="form-label">Historian tagname (FullName)</label>
|
||||
<input type="text" class="form-control form-control-sm mono" value="@_m.FullName"
|
||||
placeholder="Reactor1.Temperature"
|
||||
@onchange="@(e => Update(() => _m.FullName = e.Value?.ToString() ?? string.Empty))" />
|
||||
<div class="form-text">The AVEVA Historian tagname the driver reads against.</div></div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" checked="@_m.IsHistorized"
|
||||
@onchange="@(e => Update(() => _m.IsHistorized = e.Value is true))" />
|
||||
<label class="form-check-label">Historized (expose OPC UA HistoryRead)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12"><label class="form-label">Historian tagname override (optional)</label>
|
||||
<input type="text" class="form-control form-control-sm mono" value="@_m.HistorianTagname"
|
||||
@onchange="@(e => Update(() => _m.HistorianTagname = e.Value?.ToString() ?? string.Empty))" />
|
||||
<div class="form-text">Blank defaults the historian tagname to the FullName above.</div></div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string? ConfigJson { get; set; }
|
||||
[Parameter] public EventCallback<string> ConfigJsonChanged { get; set; }
|
||||
|
||||
private HistorianWonderwareTagConfigModel _m = new();
|
||||
private string? _lastConfigJson;
|
||||
|
||||
// Re-parse only when the incoming JSON actually changes, so an unrelated parent re-render
|
||||
// (Blazor Server live-status pushes do this) can't reset the user's in-progress edits.
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (ConfigJson == _lastConfigJson) { return; }
|
||||
_lastConfigJson = ConfigJson;
|
||||
_m = HistorianWonderwareTagConfigModel.FromJson(ConfigJson);
|
||||
}
|
||||
|
||||
private async Task Update(Action apply)
|
||||
{
|
||||
apply();
|
||||
await ConfigJsonChanged.InvokeAsync(_m.ToJson());
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
@using ZB.MOM.WW.OtOpcUa.AdminUI.Uns.TagEditors
|
||||
|
||||
<div class="row g-2">
|
||||
<div class="col-md-12"><label class="form-label">Upstream node reference (FullName)</label>
|
||||
<input type="text" class="form-control form-control-sm mono" value="@_m.FullName"
|
||||
placeholder="nsu=urn:server:ns;s=Line3.Temp"
|
||||
@onchange="@(e => Update(() => _m.FullName = e.Value?.ToString() ?? string.Empty))" />
|
||||
<div class="form-text">The remote OPC UA NodeId the driver reads/writes/subscribes against. Use the browse picker on the driver page to find it.</div></div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" checked="@_m.IsHistorized"
|
||||
@onchange="@(e => Update(() => _m.IsHistorized = e.Value is true))" />
|
||||
<label class="form-check-label">Historized (expose OPC UA HistoryRead)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12"><label class="form-label">Historian tagname override (optional)</label>
|
||||
<input type="text" class="form-control form-control-sm mono" value="@_m.HistorianTagname"
|
||||
@onchange="@(e => Update(() => _m.HistorianTagname = e.Value?.ToString() ?? string.Empty))" />
|
||||
<div class="form-text">Blank defaults the historian tagname to the FullName above.</div></div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string? ConfigJson { get; set; }
|
||||
[Parameter] public EventCallback<string> ConfigJsonChanged { get; set; }
|
||||
|
||||
private OpcUaClientTagConfigModel _m = new();
|
||||
private string? _lastConfigJson;
|
||||
|
||||
// Re-parse only when the incoming JSON actually changes, so an unrelated parent re-render
|
||||
// (Blazor Server live-status pushes do this) can't reset the user's in-progress edits.
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (ConfigJson == _lastConfigJson) { return; }
|
||||
_lastConfigJson = ConfigJson;
|
||||
_m = OpcUaClientTagConfigModel.FromJson(ConfigJson);
|
||||
}
|
||||
|
||||
private async Task Update(Action apply)
|
||||
{
|
||||
apply();
|
||||
await ConfigJsonChanged.InvokeAsync(_m.ToJson());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user