c1fe7fbc4a
Browse renders the Galaxy hierarchy tree from IGalaxyHierarchyCache: expandable areas/objects with attribute name, data type and the alarm/historized flags, plus a name/reference filter. Right-click or double-click an attribute to add it to a subscription panel that polls live value, quality and source timestamp every two seconds. Alarms lists the worker's currently-active alarm set via IAlarmRpcDispatcher, defaulting to unacknowledged Active alarms with filters for acknowledged alarms, area, severity range and text. It is read-only and warns when alarm auto-subscribe is disabled. Both tabs read live MXAccess data through a new singleton DashboardLiveDataService that owns one shared, lazily-opened gateway session (one worker) for the whole dashboard, re-opened transparently if it faults or its lease expires. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
103 lines
3.6 KiB
Plaintext
103 lines
3.6 KiB
Plaintext
@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.
|
|
*@
|
|
|
|
<div class="tree-node">
|
|
<div class="tree-row @(Node.IsArea ? "tree-row-area" : "tree-row-object")">
|
|
@if (Node.HasChildren)
|
|
{
|
|
<button type="button" class="tree-toggle" @onclick="Toggle" aria-label="Toggle">
|
|
@(_expanded ? "▾" : "▸")
|
|
</button>
|
|
}
|
|
else
|
|
{
|
|
<span class="tree-toggle tree-toggle-empty"></span>
|
|
}
|
|
<span class="tree-label" @onclick="Toggle">
|
|
<span class="tree-icon">@(Node.IsArea ? "▣" : "◇")</span>
|
|
<span class="tree-name">@Node.DisplayName</span>
|
|
@if (!string.IsNullOrWhiteSpace(Node.Object.TagName)
|
|
&& !string.Equals(Node.Object.TagName, Node.DisplayName, StringComparison.Ordinal))
|
|
{
|
|
<code class="tree-tag">@Node.Object.TagName</code>
|
|
}
|
|
</span>
|
|
</div>
|
|
@if (_expanded)
|
|
{
|
|
<div class="tree-children">
|
|
@foreach (DashboardBrowseNode child in Node.Children)
|
|
{
|
|
<BrowseTreeNodeView Node="child" OnAddTag="OnAddTag" OnTagContextMenu="OnTagContextMenu" />
|
|
}
|
|
@foreach (GalaxyAttribute attr in Node.Attributes)
|
|
{
|
|
GalaxyAttribute row = attr;
|
|
<div class="tree-attr"
|
|
title="@row.FullTagReference"
|
|
@oncontextmenu:preventDefault="true"
|
|
@oncontextmenu="@(args => OnTagContextMenu.InvokeAsync((args, row)))"
|
|
@ondblclick="@(() => OnAddTag.InvokeAsync(row.FullTagReference))">
|
|
<span class="tree-toggle tree-toggle-empty"></span>
|
|
<span class="attr-icon">·</span>
|
|
<span class="attr-name">@row.AttributeName</span>
|
|
<span class="attr-type">@DisplayType(row)</span>
|
|
@if (row.IsAlarm)
|
|
{
|
|
<span class="attr-flag attr-flag-alarm">alarm</span>
|
|
}
|
|
@if (row.IsHistorized)
|
|
{
|
|
<span class="attr-flag attr-flag-hist">hist</span>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
/// <summary>The hierarchy node this view renders.</summary>
|
|
[Parameter]
|
|
[EditorRequired]
|
|
public DashboardBrowseNode Node { get; set; } = null!;
|
|
|
|
/// <summary>Raised with a tag's full reference when the operator double-clicks it.</summary>
|
|
[Parameter]
|
|
public EventCallback<string> OnAddTag { get; set; }
|
|
|
|
/// <summary>Raised when an attribute row is right-clicked, for the context menu.</summary>
|
|
[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;
|
|
}
|
|
}
|