fix(raw): tag edit modal feeds the picker the merged device config, not '{}' (#468 follow-up)
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
passed in and drives the typed TagConfig editor dispatch (TagConfigEditorMap; raw-JSON fallback for
|
||||
unmapped drivers, e.g. Galaxy). Edit-only: the host opens it for an existing tree node (TagId), it
|
||||
loads via LoadTagForEditAsync, and saves via UpdateTagAsync. Visibility is @bind-Visible; a successful
|
||||
save raises OnSaved so the coordinator can refresh the tree. *@
|
||||
save raises OnSaved so the coordinator can refresh the tree. The editor also receives the merged
|
||||
Driver+Device probe config, which is what its address picker dials when browsing the live device. *@
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using ZB.MOM.WW.OtOpcUa.AdminUI.Uns
|
||||
@@ -140,11 +141,17 @@
|
||||
// reload + clobber in-progress edits. Null while closed.
|
||||
private string? _loadedKey;
|
||||
|
||||
// Merged Driver+Device config for the typed editor's address picker — the same blob Test-connect and
|
||||
// RawBrowseModal dial, resolved once per open. Null (→ "{}") when the resolve failed: the picker's
|
||||
// browse then degrades to its graceful error chip.
|
||||
private string? _mergedConfigJson;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!Visible)
|
||||
{
|
||||
_loadedKey = null; // closed → next open reloads fresh
|
||||
_mergedConfigJson = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,14 +187,31 @@
|
||||
TagConfig = string.IsNullOrWhiteSpace(d.TagConfig) ? "{}" : d.TagConfig,
|
||||
};
|
||||
_rowVersion = d.RowVersion;
|
||||
|
||||
_mergedConfigJson = null;
|
||||
try
|
||||
{
|
||||
var merged = await Svc.LoadMergedProbeConfigAsync(d.DeviceId);
|
||||
if (merged is { } m)
|
||||
{
|
||||
_mergedConfigJson = m.MergedConfigJson;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fail-soft: the modal must open and save regardless of the probe-config resolve. Only the
|
||||
// browse affordance degrades, and it reports its own error when used.
|
||||
}
|
||||
}
|
||||
|
||||
private IDictionary<string, object> BuildEditorParameters() => new Dictionary<string, object>
|
||||
/// <summary>Parameters handed to the typed TagConfig editor. Internal so tests can assert them.</summary>
|
||||
internal IDictionary<string, object> BuildEditorParameters() => new Dictionary<string, object>
|
||||
{
|
||||
["ConfigJson"] = _form.TagConfig,
|
||||
["ConfigJsonChanged"] = EventCallback.Factory.Create<string>(this, v => _form.TagConfig = v),
|
||||
["DriverType"] = DriverType ?? "",
|
||||
["GetDriverConfigJson"] = (Func<string>)(() => "{}"),
|
||||
// Live accessor, not a snapshot: the picker reads it when the operator clicks Browse.
|
||||
["GetDriverConfigJson"] = (Func<string>)(() => _mergedConfigJson ?? "{}"),
|
||||
};
|
||||
|
||||
private async Task SaveAsync()
|
||||
|
||||
Reference in New Issue
Block a user