5ae67a48ba
v2-ci / build (push) Failing after 34s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (push) Has been skipped
Pattern proof for the live-edit forms gated by Phases A–D's read views.
Each entity gets a single edit page handling both create (route param
omitted) and update (route param present) modes, with RowVersion-based
optimistic concurrency checked against EF Core's
DbUpdateConcurrencyException.
Pattern:
- @page "/clusters/{id}/<thing>/new"
- @page "/clusters/{id}/<thing>/{rowId}"
- IsNew computed from rowId presence
- EditForm + DataAnnotations validation
- byte[] RowVersion stashed on FormModel; assigned to
Entry(e).Property(e => e.RowVersion).OriginalValue before SaveChanges
- Delete button (edit mode only) flows through the same RowVersion check
- Concurrency conflict surfaces as an inline error panel; user reloads
This batch:
- NamespaceEdit.razor — small entity, validates the pattern
- DriverEdit.razor — keystone for everything downstream
(Equipment/Tag/VirtualTag/ScriptedAlarm),
JSON config editor per Q1 with reformat
on save and validation pre-flight
- ClusterNamespaces row gains an Edit button + New action
- ClusterDrivers expanded view gains an Edit button + New action
Equipment/UnsArea/UnsLine/Tag/ACL/VirtualTag/ScriptedAlarm/Script forms
follow this same template in subsequent F15.2 batches.
All 9 integration tests still green; no v2 test regressions.
91 lines
3.7 KiB
Plaintext
91 lines
3.7 KiB
Plaintext
@page "/clusters/{ClusterId}/drivers"
|
|
@attribute [Microsoft.AspNetCore.Authorization.Authorize]
|
|
@rendermode RenderMode.InteractiveServer
|
|
@using Microsoft.EntityFrameworkCore
|
|
@using ZB.MOM.WW.OtOpcUa.Configuration
|
|
@using ZB.MOM.WW.OtOpcUa.Configuration.Entities
|
|
@inject IDbContextFactory<OtOpcUaConfigDbContext> DbFactory
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h4 class="mb-0">Drivers · <span class="mono">@ClusterId</span></h4>
|
|
<a href="/clusters/@ClusterId/drivers/new" class="btn btn-primary btn-sm">New driver</a>
|
|
</div>
|
|
|
|
<ClusterNav ClusterId="@ClusterId" ActiveTab="drivers" />
|
|
|
|
@if (_rows is null)
|
|
{
|
|
<p>Loading…</p>
|
|
}
|
|
else
|
|
{
|
|
<section class="panel notice rise" style="animation-delay:.02s">
|
|
Per Q1 of the AdminUI rebuild plan, typed driver editors (Modbus, FOCAS) are deferred.
|
|
The expanded view below shows raw JSON config. Live editing — including a generic JSON
|
|
editor and per-driver-type forms when operators ask — lands in a Phase C.2 follow-up.
|
|
</section>
|
|
|
|
<section class="panel rise mt-3" style="animation-delay:.08s">
|
|
<div class="panel-head">@_rows.Count driver instance@(_rows.Count == 1 ? "" : "s")</div>
|
|
@if (_rows.Count == 0)
|
|
{
|
|
<div style="padding:1rem" class="text-muted">No driver instances for this cluster.</div>
|
|
}
|
|
else
|
|
{
|
|
@foreach (var d in _rows)
|
|
{
|
|
<details style="border-top:1px solid var(--rule)">
|
|
<summary style="padding:.75rem 1rem;cursor:pointer">
|
|
<span class="mono">@d.DriverInstanceId</span>
|
|
· <span>@d.Name</span>
|
|
· <span class="chip chip-idle ms-1">@d.DriverType</span>
|
|
@if (!d.Enabled) { <span class="chip chip-idle ms-1">Disabled</span> }
|
|
<span class="text-muted small ms-2">ns=@d.NamespaceId</span>
|
|
</summary>
|
|
<div style="padding:0 1rem 1rem">
|
|
<div class="d-flex mb-2">
|
|
<a href="/clusters/@ClusterId/drivers/@d.DriverInstanceId" class="btn btn-sm btn-outline-primary">Edit</a>
|
|
</div>
|
|
<pre class="mono small" style="background:var(--surface-2);padding:1rem;border-radius:4px;overflow:auto">@FormatJson(d.DriverConfig)</pre>
|
|
@if (!string.IsNullOrWhiteSpace(d.ResilienceConfig))
|
|
{
|
|
<div class="text-muted small mt-2">Resilience overrides:</div>
|
|
<pre class="mono small" style="background:var(--surface-2);padding:1rem;border-radius:4px;overflow:auto">@FormatJson(d.ResilienceConfig)</pre>
|
|
}
|
|
</div>
|
|
</details>
|
|
}
|
|
}
|
|
</section>
|
|
}
|
|
|
|
@code {
|
|
[Parameter] public string ClusterId { get; set; } = "";
|
|
private List<DriverInstance>? _rows;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await using var db = await DbFactory.CreateDbContextAsync();
|
|
_rows = await db.DriverInstances.AsNoTracking()
|
|
.Where(d => d.ClusterId == ClusterId)
|
|
.OrderBy(d => d.DriverInstanceId)
|
|
.ToListAsync();
|
|
}
|
|
|
|
private static string FormatJson(string raw)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(raw)) return "";
|
|
try
|
|
{
|
|
using var doc = System.Text.Json.JsonDocument.Parse(raw);
|
|
return System.Text.Json.JsonSerializer.Serialize(doc.RootElement,
|
|
new System.Text.Json.JsonSerializerOptions { WriteIndented = true });
|
|
}
|
|
catch
|
|
{
|
|
return raw;
|
|
}
|
|
}
|
|
}
|