feat(adminui): B2-WP3 driver/device config modals + page-to-form refactor
Extract the 8 typed driver pages into embeddable <Driver>DriverForm bodies (channel/protocol config) and add per-driver <Driver>DeviceForm bodies (connection endpoint -> Device.DeviceConfig, v3 endpoint split). New DriverConfigModal + DeviceModal dispatch by DriverType (DriverTypeNames) for the /raw tree; Test-connect inside DeviceModal builds the merged Driver+Device config transiently via DriverDeviceConfigMerger. Routed pages now host the form bodies and keep working. Round-trip + enum-serialization guard tests for the Modbus driver form + Modbus device model; retargeted the existing page-form serialization tests + the _jsonOpts converter guard to the forms. Claude-Session: https://claude.ai/code/session_01LVneM3eh1UtJxEisFXgmox
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
using ZB.MOM.WW.OtOpcUa.AdminUI.Uns.TagEditors;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers.DeviceForms;
|
||||
|
||||
/// <summary>
|
||||
/// Device model for the AVEVA Galaxy driver. Galaxy connects to a SINGLE mxaccessgw gateway configured
|
||||
/// on the <b>driver</b> (nested Gateway/MxAccess records) — there is no flat per-device connection
|
||||
/// endpoint to author, so this model authors no endpoint keys. It simply round-trips the DeviceConfig
|
||||
/// JSON verbatim (preserving any keys) so the device row stays valid. (Flagged: Galaxy has no v3
|
||||
/// endpoint→DeviceConfig split; its connection lives on the driver config.)
|
||||
/// </summary>
|
||||
public sealed class GalaxyDeviceModel
|
||||
{
|
||||
private System.Text.Json.Nodes.JsonObject _bag = new();
|
||||
|
||||
/// <summary>Loads a model from a DeviceConfig JSON string, retaining every original key.</summary>
|
||||
/// <param name="json">The raw DeviceConfig JSON string, or null for a new/empty device.</param>
|
||||
/// <returns>The populated <see cref="GalaxyDeviceModel"/>.</returns>
|
||||
public static GalaxyDeviceModel FromJson(string? json)
|
||||
=> new() { _bag = TagConfigJson.ParseOrNew(json) };
|
||||
|
||||
/// <summary>Serializes the (preserved) DeviceConfig back to a JSON string.</summary>
|
||||
/// <returns>The serialised DeviceConfig JSON string.</returns>
|
||||
public string ToJson() => TagConfigJson.Serialize(_bag);
|
||||
|
||||
/// <summary>Validation hook; Galaxy device rows carry no endpoint, so always valid.</summary>
|
||||
/// <returns><c>null</c> — no per-device endpoint to validate.</returns>
|
||||
public string? Validate() => null;
|
||||
}
|
||||
Reference in New Issue
Block a user