fix(raw): manual tag entry feeds each row's picker the merged device config (#468 follow-up)
This commit is contained in:
+25
-3
@@ -1,7 +1,8 @@
|
||||
@* Bulk manual tag-entry grid for the v3 /raw tree: add MANY new tags at once under a Device or a
|
||||
TagGroup. Each row carries Name / DataType / AccessLevel / WriteIdempotent / PollGroup plus a
|
||||
per-row driver-typed TagConfig editor (revealed in an expandable full-width sub-row — the grid stays
|
||||
compact). The owning DriverType (fixed by the device) drives the typed-editor dispatch. On commit each
|
||||
compact), each fed the merged Driver+Device probe config so its address picker can browse the live
|
||||
device. The owning DriverType (fixed by the device) drives the typed-editor dispatch. On commit each
|
||||
row is created via CreateTagAsync; committed rows drop off, failed rows stay with their inline error so
|
||||
nothing is lost silently. Visibility is @bind-Visible; a successful commit raises OnSaved. *@
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@@ -159,11 +160,17 @@
|
||||
private bool _summaryOk;
|
||||
private bool _open; // guards re-seeding rows on unrelated re-renders
|
||||
|
||||
protected override void OnParametersSet()
|
||||
// Merged Driver+Device config for each row's address picker — the same blob Test-connect and
|
||||
// RawBrowseModal dial, resolved once per open; null (→ "{}") when the resolve failed: the picker's
|
||||
// browse degrades to its graceful error chip.
|
||||
private string? _mergedConfigJson;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!Visible)
|
||||
{
|
||||
_open = false;
|
||||
_mergedConfigJson = null;
|
||||
return;
|
||||
}
|
||||
if (_open) { return; } // same open, re-render → preserve in-progress rows
|
||||
@@ -172,6 +179,21 @@
|
||||
_rows.Add(new RowModel());
|
||||
_summary = null;
|
||||
_summaryOk = false;
|
||||
|
||||
_mergedConfigJson = null;
|
||||
if (!string.IsNullOrEmpty(DeviceId))
|
||||
{
|
||||
try
|
||||
{
|
||||
var merged = await Svc.LoadMergedProbeConfigAsync(DeviceId);
|
||||
if (merged is { } m) { _mergedConfigJson = m.MergedConfigJson; }
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fail-soft: the grid must stay usable regardless — only the browse affordance inside each
|
||||
// row's picker degrades, and it reports its own error on use.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IDictionary<string, object> BuildEditorParameters(RowModel row) => new Dictionary<string, object>
|
||||
@@ -179,7 +201,7 @@
|
||||
["ConfigJson"] = row.TagConfig,
|
||||
["ConfigJsonChanged"] = EventCallback.Factory.Create<string>(this, v => row.TagConfig = v),
|
||||
["DriverType"] = DriverType,
|
||||
["GetDriverConfigJson"] = (Func<string>)(() => "{}"),
|
||||
["GetDriverConfigJson"] = (Func<string>)(() => _mergedConfigJson ?? "{}"),
|
||||
};
|
||||
|
||||
private void AddRow() => _rows.Add(new RowModel());
|
||||
|
||||
Reference in New Issue
Block a user