diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Drivers/DriverIdentitySection.razor b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Drivers/DriverIdentitySection.razor new file mode 100644 index 00000000..4ea1b08e --- /dev/null +++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Drivers/DriverIdentitySection.razor @@ -0,0 +1,82 @@ +@* Identity section shared across the generic DriverEdit page and the typed driver pages (Phase 4). + The parent page owns the and all data loading/persistence — this component is + purely a section of inputs. + Set ShowDriverType=true on the generic editor; typed pages leave it false (type is fixed). *@ +@using System.ComponentModel.DataAnnotations +@using ZB.MOM.WW.OtOpcUa.Configuration.Entities + +
+
@(IsNew ? "Identity" : $"Edit {Model.DriverInstanceId}")
+
+
+
+ + + +
+
+ + + +
+
+
+ @if (ShowDriverType) + { +
+ + + + + + + + + + + + +
Cannot be changed after creation — drives the actor type that owns this instance.
+
+ } +
+ + + @foreach (var ns in Namespaces) + { + + } + + +
+
+
+ +
+ + +
+
+
+
+ +@code { + [Parameter, EditorRequired] public DriverIdentityModel Model { get; set; } = new(); + [Parameter, EditorRequired] public IReadOnlyList Namespaces { get; set; } = []; + [Parameter] public bool IsNew { get; set; } + [Parameter] public bool ShowDriverType { get; set; } + + public sealed class DriverIdentityModel + { + [Required, RegularExpression("^[A-Za-z0-9_-]+$", ErrorMessage = "Use letters, digits, dash, underscore.")] + public string DriverInstanceId { get; set; } = ""; + [Required] public string Name { get; set; } = ""; + [Required] public string DriverType { get; set; } = "ModbusTcp"; + [Required] public string NamespaceId { get; set; } = ""; + public bool Enabled { get; set; } = true; + } +}