feat(central-ui): Flow Debugger picks the instance through InstancePicker
The script entry's flat instance <select> is replaced by the shared
InstancePicker combobox (design 2026-09-08 §3): the site's areas load
alongside its instances in LoadInstancesAsync and are held in fields, so the
picker sees one stable list reference per site and only closes its panel on a
real site change. Picking a row raises the id, which OnInstancePickedAsync
applies before running the unchanged OnInstanceChangedAsync — the deep link,
the localStorage restore and the site-scope gate are untouched.
Tests: the five instance-select .Change("7") call sites go through a
PickInstance helper (open the panel, click the data-instance-id row), plus a
new test that areas open collapsed and only reveal the instance once both
levels are expanded, and one that ?instanceId= shows the instance name in the
picker field.
Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
+31
-3
@@ -111,7 +111,17 @@ public partial class FlowDebugger : ComponentBase, IDisposable
|
||||
|
||||
private List<ApiMethod> _methods = [];
|
||||
private List<Site> _sites = [];
|
||||
|
||||
/// <summary>
|
||||
/// The selected site's instances, feeding the <c>InstancePicker</c> alongside
|
||||
/// <see cref="_areas"/>. The picker compares both by REFERENCE — a new list object is read
|
||||
/// as "the site changed" and closes its panel — so they are assigned exactly once per site
|
||||
/// load (<see cref="LoadInstancesAsync"/>) and never rebuilt on a render path.
|
||||
/// </summary>
|
||||
private List<Instance> _instances = [];
|
||||
|
||||
/// <summary>The selected site's areas; the picker nests them into its tree. See <see cref="_instances"/>.</summary>
|
||||
private List<Area> _areas = [];
|
||||
private List<FlowScriptOption> _scripts = [];
|
||||
|
||||
private int _selectedMethodId;
|
||||
@@ -411,9 +421,27 @@ public partial class FlowDebugger : ComponentBase, IDisposable
|
||||
|
||||
private async Task LoadInstancesAsync()
|
||||
{
|
||||
_instances = _selectedSiteId > 0
|
||||
? (await TemplateEngineRepository.GetInstancesBySiteIdAsync(_selectedSiteId)).OrderBy(i => i.UniqueName, StringComparer.OrdinalIgnoreCase).ToList()
|
||||
: [];
|
||||
if (_selectedSiteId <= 0)
|
||||
{
|
||||
_instances = [];
|
||||
_areas = [];
|
||||
return;
|
||||
}
|
||||
|
||||
_instances = (await TemplateEngineRepository.GetInstancesBySiteIdAsync(_selectedSiteId))
|
||||
.OrderBy(i => i.UniqueName, StringComparer.OrdinalIgnoreCase).ToList();
|
||||
// The picker nests these itself (InstanceTreeBuilder), so order does not matter here.
|
||||
_areas = (await TemplateEngineRepository.GetAreasBySiteIdAsync(_selectedSiteId)).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The picker raises the id rather than binding a <select>, so the page applies it
|
||||
/// before running the same change handler the old dropdown used.
|
||||
/// </summary>
|
||||
private async Task OnInstancePickedAsync(int id)
|
||||
{
|
||||
_selectedInstanceId = id;
|
||||
await OnInstanceChangedAsync();
|
||||
}
|
||||
|
||||
/// <summary>The instance's scripts, from its flattened configuration (canonical names, effective triggers).</summary>
|
||||
|
||||
Reference in New Issue
Block a user