Merge branch 'worktree-agent-a24fb696f5eee22f2' into feat/instance-picker
This commit is contained in:
@@ -59,14 +59,18 @@
|
|||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
@* Wider than the site select beside it: the field carries a whole instance
|
||||||
|
name, not a short site name. The script-entry branch still sums to 8 of 12
|
||||||
|
(site 2 + instance 3 + script 3) alongside the auto-width toolbar columns. *@
|
||||||
|
<div class="col-md-3">
|
||||||
<label class="form-label form-label-sm">Instance</label>
|
<label class="form-label form-label-sm">Instance</label>
|
||||||
@* A site can hold hundreds of instances, so this is the shared area-tree
|
@* A site can hold hundreds of instances, so this is the shared area-tree
|
||||||
combobox, not a flat list (design 2026-09-08). _areas/_instances are
|
combobox, not a flat list (design 2026-09-08). _areas/_instances are
|
||||||
loaded once per site — the picker treats a new list as a site change. *@
|
loaded once per site — the picker treats a new list as a site change. *@
|
||||||
<InstancePicker Areas="_areas" Instances="_instances"
|
<InstancePicker Areas="_areas" Instances="_instances"
|
||||||
SelectedInstanceId="_selectedInstanceId" SelectedInstanceIdChanged="OnInstancePickedAsync"
|
SelectedInstanceId="_selectedInstanceId" SelectedInstanceIdChanged="OnInstancePickedAsync"
|
||||||
Disabled="@(_running || _selectedSiteId == 0)" DataTestPrefix="flow-instance" />
|
Disabled="@(_running || _selectedSiteId == 0)"
|
||||||
|
Placeholder="Search instances…" DataTestPrefix="flow-instance" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<label class="form-label form-label-sm">Script</label>
|
<label class="form-label form-label-sm">Script</label>
|
||||||
|
|||||||
@@ -815,4 +815,31 @@ public class FlowDebuggerPageTests : BunitContext
|
|||||||
cut.WaitForAssertion(() =>
|
cut.WaitForAssertion(() =>
|
||||||
Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value")));
|
Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ScriptEntry_SiteChange_ClearsThePickedInstance()
|
||||||
|
{
|
||||||
|
RegisterServices();
|
||||||
|
WireInstance();
|
||||||
|
// A second site the operator can switch to, with no instances of its own.
|
||||||
|
_sites.GetAllSitesAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult<IReadOnlyList<Site>>(
|
||||||
|
[new Site("Plant A", "site-a") { Id = 1 }, new Site("Plant B", "site-b") { Id = 2 }]));
|
||||||
|
_templates.GetInstancesBySiteIdAsync(2, Arg.Any<CancellationToken>())
|
||||||
|
.Returns(Task.FromResult<IReadOnlyList<Instance>>([]));
|
||||||
|
_templates.GetAreasBySiteIdAsync(2, Arg.Any<CancellationToken>())
|
||||||
|
.Returns(Task.FromResult<IReadOnlyList<Area>>([]));
|
||||||
|
|
||||||
|
var cut = Render<FlowDebuggerPage>();
|
||||||
|
cut.Find("button[data-test='flow-entry-script']").Click();
|
||||||
|
cut.Find("select[data-test='flow-site-select']").Change("1");
|
||||||
|
PickInstance(cut, 7);
|
||||||
|
Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value"));
|
||||||
|
|
||||||
|
cut.Find("select[data-test='flow-site-select']").Change("2");
|
||||||
|
|
||||||
|
// The pick is dropped on both sides: the page's id and the picker's field text, which
|
||||||
|
// it re-derives because the new site handed it a different instance list.
|
||||||
|
Assert.Equal(string.Empty, cut.Find("[data-test='flow-instance-input']").GetAttribute("value"));
|
||||||
|
Assert.Equal(["— choose —"], cut.FindAll("select[data-test='flow-script-select'] option").Select(o => o.TextContent.Trim()).ToList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user