@page "/clusters/{ClusterId}/draft/{GenerationId:long}" @using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Configuration.Validation @inject GenerationService GenerationSvc @inject DraftValidationService ValidationSvc @inject NavigationManager Nav

Draft editor

Cluster @ClusterId · generation @GenerationId
Back to cluster View diff
@if (_tab == "equipment") { } else if (_tab == "uns") { } else if (_tab == "namespaces") { } else if (_tab == "drivers") { } else if (_tab == "acls") { }
Validation
@if (_validating) {

Checking…

} else if (_errors.Count == 0) {
No validation errors — safe to publish.
} else {
@_errors.Count error@(_errors.Count == 1 ? "" : "s")
    @foreach (var e in _errors) {
  • @e.Code @e.Message @if (!string.IsNullOrEmpty(e.Context)) {
    @e.Context
    }
  • }
}
@if (_publishError is not null) {
@_publishError
}
@code { [Parameter] public string ClusterId { get; set; } = string.Empty; [Parameter] public long GenerationId { get; set; } private string _tab = "equipment"; private List _errors = []; private bool _validating; private bool _busy; private string? _publishError; private string Active(string k) => _tab == k ? "active" : string.Empty; protected override async Task OnParametersSetAsync() => await RevalidateAsync(); private async Task RevalidateAsync() { _validating = true; try { var errors = await ValidationSvc.ValidateAsync(GenerationId, CancellationToken.None); _errors = errors.ToList(); } finally { _validating = false; } } private async Task PublishAsync() { _busy = true; _publishError = null; try { await GenerationSvc.PublishAsync(ClusterId, GenerationId, notes: "Published via Admin UI", CancellationToken.None); Nav.NavigateTo($"/clusters/{ClusterId}"); } catch (Exception ex) { _publishError = ex.Message; } finally { _busy = false; } } }