fix(admin-ui): associate native device endpoint fields
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
@page "/"
|
||||
@rendermode InteractiveServer
|
||||
<main class="container-fluid p-3"><h1>Device field accessibility fixture</h1><p>Synthetic local drafts only. No backend services or connection actions.</p>
|
||||
<button @onclick="() => _changes++">Verify local interactivity</button><output id="changes">@_changes</output><output id="interactive">@_ready</output>
|
||||
<EditForm EditContext="_context" OnSubmit="IgnoreSubmit">
|
||||
@foreach (var type in Types)
|
||||
{
|
||||
@for (int copy = 0; copy < 2; copy++)
|
||||
{
|
||||
var key = type.Name + copy;
|
||||
<section data-device="@type.Name" data-copy="@copy" @key="key"><h2>@type.Name · instance @copy</h2><DynamicComponent Type="type" Parameters="Values(type, key)" /></section>
|
||||
}
|
||||
}
|
||||
</EditForm></main>
|
||||
@code {
|
||||
private readonly EditContext _context = new(new object());
|
||||
private readonly Dictionary<string, string> _values = new();
|
||||
private int _changes;
|
||||
private bool _ready;
|
||||
protected override void OnAfterRender(bool firstRender) { if (firstRender) { _ready = true; StateHasChanged(); } }
|
||||
private static readonly Type[] Types = [typeof(AbCipDeviceForm), typeof(AbLegacyDeviceForm), typeof(FocasDeviceForm), typeof(HeidenhainDeviceForm), typeof(ModbusDeviceForm), typeof(OpcUaClientDeviceForm), typeof(S7DeviceForm), typeof(TwinCATDeviceForm)];
|
||||
private Dictionary<string, object> Values(Type type, string key) => new()
|
||||
{
|
||||
["DeviceConfigJson"] = _values.GetValueOrDefault(key, "{}"),
|
||||
["DeviceConfigJsonChanged"] = EventCallback.Factory.Create<string>(this, value => { _values[key] = value; _changes++; })
|
||||
};
|
||||
private void IgnoreSubmit(EditContext context) { }
|
||||
}
|
||||
Reference in New Issue
Block a user