Files
lmxopcua/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Drivers/DriverIdentitySection.razor
T
Joseph Doherty b295b24419 feat(adminui): author + configure the Sql driver in /raw
The read-only Sql driver's runtime factory/probe and tag-side editors were
wired, but the AdminUI could not author the DRIVER: the /raw "New driver" type
list, the DriverConfigModal switch, and the legacy identity dropdown all omitted
Sql, and no SqlDriverForm existed. Live-driving the AdminUI surfaced this.

- Add SqlDriverForm.razor over the SqlDriverConfigDto shape: Provider
  (SqlServer-only in v1), required connectionStringRef (an env-var NAME, not a
  connection string — label is explicit), optional poll/operation/command
  timeouts, maxConcurrentGroups, nullIsBad. Enums serialize by NAME via
  JsonStringEnumConverter; a connection-string literal can never be authored
  (no such field is collected); rawTags (composer-owned) + allowWrites (inert,
  read-only v1) are never emitted.
- Wire Sql into DriverConfigModal switch, RawDriverTypeDialog type list, and
  DriverIdentitySection legacy dropdown.
- Add SqlDriverFormContractTests: the exact JSON the form emits constructs a
  driver through the real factory, missing connectionStringRef is rejected, and
  provider round-trips as the "SqlServer" name (never an ordinal).

Claude-Session: https://claude.ai/code/session_01GASWkNEi68FSCtvr6rLoEW
2026-07-24 20:41:33 -04:00

69 lines
3.4 KiB
Plaintext

@* Identity section shared by the typed driver pages. The parent page owns the <EditForm> and all
data loading/persistence — this component is purely a section of inputs. *@
@using System.ComponentModel.DataAnnotations
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities
<section class="panel rise" style="animation-delay:.02s">
<div class="panel-head">@(IsNew ? "Identity" : $"Edit {Model.DriverInstanceId}")</div>
<div style="padding:1rem">
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label" for="instId">DriverInstanceId</label>
<InputText id="instId" @bind-Value="Model.DriverInstanceId" disabled="@(!IsNew)"
class="form-control form-control-sm mono"
placeholder="drv-modbus-line3-01" />
<ValidationMessage For="@(() => Model.DriverInstanceId)" />
</div>
<div class="col-md-6 mb-3">
<label class="form-label" for="name">Display name</label>
<InputText id="name" @bind-Value="Model.Name" class="form-control form-control-sm"
placeholder="Line 3 Modbus" />
<ValidationMessage For="@(() => Model.Name)" />
</div>
</div>
<div class="row">
@if (ShowDriverType)
{
<div class="col-md-6 mb-3">
<label class="form-label" for="dtype">Driver type</label>
<InputSelect id="dtype" @bind-Value="Model.DriverType" disabled="@(!IsNew)"
class="form-select form-select-sm">
<option value="Modbus">Modbus TCP</option>
<option value="AbCip">AbCip</option>
<option value="AbLegacy">AbLegacy</option>
<option value="S7">S7</option>
<option value="TwinCat">TwinCat</option>
<option value="Focas">Focas</option>
<option value="OpcUaClient">OpcUaClient</option>
<option value="GalaxyMxGateway">Galaxy</option>
<option value="Sql">Sql</option>
</InputSelect>
<div class="form-text">Cannot be changed after creation — drives the actor type that owns this instance.</div>
</div>
}
</div>
<div class="mb-3">
<label class="form-label" for="enabled">Enabled</label>
<div class="form-check form-switch">
<InputCheckbox id="enabled" @bind-Value="Model.Enabled" class="form-check-input" />
<label class="form-check-label" for="enabled">Spawn this driver in deployments</label>
</div>
</div>
</div>
</section>
@code {
[Parameter, EditorRequired] public DriverIdentityModel Model { get; set; } = new();
[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; } = "Modbus";
public bool Enabled { get; set; } = true;
}
}