@using MxGateway.Contracts.Proto.Galaxy @* Recursive Browse hierarchy node. Renders one Galaxy object, its child objects (recursively), and its attributes as right-clickable tag rows. Expansion state is local; children render only while expanded. *@
@if (Node.HasChildren) { } else { } @(Node.IsArea ? "▣" : "◇") @Node.DisplayName @if (!string.IsNullOrWhiteSpace(Node.Object.TagName) && !string.Equals(Node.Object.TagName, Node.DisplayName, StringComparison.Ordinal)) { @Node.Object.TagName }
@if (_expanded) {
@foreach (DashboardBrowseNode child in Node.Children) { } @foreach (GalaxyAttribute attr in Node.Attributes) { GalaxyAttribute row = attr;
· @row.AttributeName @DisplayType(row) @if (row.IsAlarm) { alarm } @if (row.IsHistorized) { hist }
}
}
@code { /// The hierarchy node this view renders. [Parameter] [EditorRequired] public DashboardBrowseNode Node { get; set; } = null!; /// Raised with a tag's full reference when the operator double-clicks it. [Parameter] public EventCallback OnAddTag { get; set; } /// Raised when an attribute row is right-clicked, for the context menu. [Parameter] public EventCallback<(MouseEventArgs Event, GalaxyAttribute Attribute)> OnTagContextMenu { get; set; } private bool _expanded; private void Toggle() { if (Node.HasChildren) { _expanded = !_expanded; } } private static string DisplayType(GalaxyAttribute attribute) { string baseType = string.IsNullOrWhiteSpace(attribute.DataTypeName) ? "type?" : attribute.DataTypeName; if (attribute.IsArray) { return attribute.ArrayDimensionPresent ? $"{baseType}[{attribute.ArrayDimension}]" : $"{baseType}[]"; } return baseType; } }