Complete protocol field associations and verify rendered inventory
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
@page "/protocols"
|
||||
@rendermode InteractiveServer
|
||||
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers.Forms
|
||||
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Uns.TagEditors
|
||||
<main class="container-fluid p-3"><h1>Protocol field fixture</h1><p>Synthetic drafts only; no device or backend operations.</p><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-protocol="@type.Name" data-copy="@copy" @key="key"><h2>@type.Name · instance @copy</h2><DynamicComponent Type="type" Parameters="Values(type)" /></section>
|
||||
}
|
||||
}
|
||||
</EditForm></main>
|
||||
@code {
|
||||
[SupplyParameterFromQuery] public string? Kind { get; set; }
|
||||
private readonly EditContext _context = new(new object());
|
||||
private bool _ready;
|
||||
protected override void OnAfterRender(bool firstRender) { if (firstRender) { _ready = true; StateHasChanged(); } }
|
||||
private static readonly Type[] Drivers = [typeof(AbCipDriverForm), typeof(AbLegacyDriverForm), typeof(FocasDriverForm), typeof(GalaxyDriverForm), typeof(HeidenhainDriverForm), typeof(MTConnectDriverForm), typeof(ModbusDriverForm), typeof(MqttDriverForm), typeof(OpcUaClientDriverForm), typeof(S7DriverForm), typeof(SqlDriverForm), typeof(TwinCATDriverForm)];
|
||||
private static readonly Type[] Tags = [typeof(AbCipTagConfigEditor), typeof(AbLegacyTagConfigEditor), typeof(CalculationTagConfigEditor), typeof(FocasTagConfigEditor), typeof(HeidenhainTagConfigEditor), typeof(MTConnectTagConfigEditor), typeof(ModbusTagConfigEditor), typeof(MqttTagConfigEditor), typeof(NativeAlarmEditor), typeof(OpcUaClientTagConfigEditor), typeof(S7TagConfigEditor), typeof(SqlTagConfigEditor), typeof(TwinCATTagConfigEditor)];
|
||||
private Type[] Types => Kind == "drivers" ? Drivers : Tags;
|
||||
private static Dictionary<string, object> Values(Type type) => type == typeof(NativeAlarmEditor)
|
||||
? new() { ["DriverType"] = "AbCip", ["ConfigJson"] = "{\"alarm\":{\"severity\":500}}" } : new();
|
||||
private void IgnoreSubmit(EditContext context) { }
|
||||
}
|
||||
Reference in New Issue
Block a user