@using ZB.MOM.WW.OtOpcUa.Admin.Services @using ZB.MOM.WW.OtOpcUa.Configuration.Entities @inject UnsService UnsSvc

UNS Areas

@if (_areas is null) {

Loading…

} else if (_areas.Count == 0) {

No areas yet.

} else { @foreach (var a in _areas) { }
AreaIdName
@a.UnsAreaId@a.Name
} @if (_showAreaForm) {
}

UNS Lines

@if (_lines is null) {

Loading…

} else if (_lines.Count == 0) {

No lines yet.

} else { @foreach (var l in _lines) { }
LineIdAreaName
@l.UnsLineId@l.UnsAreaId@l.Name
} @if (_showLineForm && _areas is not null) {
}
@code { [Parameter] public long GenerationId { get; set; } [Parameter] public string ClusterId { get; set; } = string.Empty; private List? _areas; private List? _lines; private bool _showAreaForm; private bool _showLineForm; private string _newAreaName = string.Empty; private string _newLineName = string.Empty; private string _newLineAreaId = string.Empty; protected override async Task OnParametersSetAsync() => await ReloadAsync(); private async Task ReloadAsync() { _areas = await UnsSvc.ListAreasAsync(GenerationId, CancellationToken.None); _lines = await UnsSvc.ListLinesAsync(GenerationId, CancellationToken.None); } private async Task AddAreaAsync() { if (string.IsNullOrWhiteSpace(_newAreaName)) return; await UnsSvc.AddAreaAsync(GenerationId, ClusterId, _newAreaName, notes: null, CancellationToken.None); _newAreaName = string.Empty; _showAreaForm = false; await ReloadAsync(); } private async Task AddLineAsync() { if (string.IsNullOrWhiteSpace(_newLineName) || string.IsNullOrWhiteSpace(_newLineAreaId)) return; await UnsSvc.AddLineAsync(GenerationId, _newLineAreaId, _newLineName, notes: null, CancellationToken.None); _newLineName = string.Empty; _showLineForm = false; await ReloadAsync(); } }