@page "/uns/convert-relays" @* Fleet-wide relay→alias converter. Previews (dry-run) and applies the conversion of pure-relay virtual tags into Galaxy alias tags across every equipment. Edits the draft config only; the operator publishes normally afterward. FleetAdmin-gated (mirrors RoleGrants.razor). *@ @attribute [Microsoft.AspNetCore.Authorization.Authorize(Policy = "FleetAdmin")] @rendermode RenderMode.InteractiveServer @using ZB.MOM.WW.OtOpcUa.AdminUI.Uns @inject IUnsTreeService Svc Convert relays

Convert relay virtual-tags to aliases

Back to UNS

Sweeps every equipment for pure-relay virtual tags (a script body that simply returns another tag's value) and rewrites each one as a Galaxy alias tag. This edits the draft configuration only — publish afterward to take effect. Run a preview first to review what will change.

@if (_applied) { Conversion applied. Publish to take effect. }
@if (!string.IsNullOrWhiteSpace(_error)) {
@_error
} @if (_preview is not null) {
Will convert (@_preview.Converted.Count)
@if (_preview.Converted.Count == 0) {
No relay virtual-tags to convert.
} else {
@foreach (var c in _preview.Converted) { }
EquipmentVirtual tagFull nameData type
@c.EquipmentId @c.VirtualTagName @c.FullName @c.DataType
}
Skipped (@_preview.Skipped.Count)
@if (_preview.Skipped.Count == 0) {
Nothing skipped.
} else {
@foreach (var s in _preview.Skipped) { }
EquipmentVirtual tagReason
@s.EquipmentId @s.VirtualTagName @s.Reason
}
@if (!_preview.Applied && _preview.Converted.Count > 0) {
@if (!_confirming) { } else { Convert @_preview.Converted.Count relay virtual-tag(s) to aliases in the draft? }
} } @code { private RelayConversionResult? _preview; private bool _busy; private bool _confirming; private bool _applied; private string? _error; private async Task PreviewAsync() { _error = null; _confirming = false; _applied = false; _busy = true; try { _preview = await Svc.ConvertRelayVirtualTagsToAliasesAsync(null, dryRun: true); } catch (Exception ex) { _error = ex.Message; } finally { _busy = false; } } private async Task ApplyAsync() { _error = null; _busy = true; try { await Svc.ConvertRelayVirtualTagsToAliasesAsync(null, dryRun: false); _applied = true; _confirming = false; // Re-run the preview so the Converted set is now empty and only remaining skips show. _preview = await Svc.ConvertRelayVirtualTagsToAliasesAsync(null, dryRun: true); } catch (Exception ex) { _error = ex.Message; } finally { _busy = false; } } }