84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
@page "/raw"
|
|
@attribute [Authorize(Policy = AdminUiPolicies.ConfigEditor)]
|
|
@* prerender: false (#577 "first tree click ignored"): with prerender on, the server-rendered tree is shown
|
|
before the circuit attaches, so a click on its (handler-less) twists is silently dropped, and the
|
|
component then re-runs OnInitializedAsync and swaps in a second, freshly loaded node set. The tree
|
|
is the only content here and needs the circuit anyway, so render it once, interactively. *@
|
|
@rendermode @(new InteractiveServerRenderMode(prerender: false))
|
|
@using ZB.MOM.WW.OtOpcUa.AdminUI.Uns
|
|
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Raw
|
|
@inject IRawTreeService Svc
|
|
|
|
@* Peer of GlobalUns (/uns) for the v3 Raw project tree — the cluster-rooted
|
|
Enterprise → Cluster → Folder → Driver → Device → TagGroup → Tag hierarchy.
|
|
Loads the eager roots on init, then hands off to RawTree, which lazily expands
|
|
each container via IRawTreeService.LoadChildrenAsync and surfaces per-node
|
|
context menus (real create/configure/tag modals arrive in later Batch-2 waves). *@
|
|
|
|
<PageErrorBoundary>
|
|
<PageTitle>Raw · OtOpcUa</PageTitle>
|
|
|
|
<div class="page-head">
|
|
<h1>Raw</h1>
|
|
<span class="spacer"></span>
|
|
<span class="text-muted small">Changes apply on the next deployment.</span>
|
|
</div>
|
|
|
|
<CredentialReferenceBanner />
|
|
|
|
<section class="panel rise" style="animation-delay:.02s">
|
|
<div class="panel-head d-flex justify-content-between align-items-center flex-wrap gap-2">
|
|
<h2 class="m-0" style="font:inherit">Project tree</h2>
|
|
</div>
|
|
|
|
@if (_loading)
|
|
{
|
|
<div style="padding:1rem" class="text-muted">
|
|
<span class="spinner-border spinner-border-sm me-1"></span>Loading…
|
|
</div>
|
|
}
|
|
else if (_loadError is not null)
|
|
{
|
|
<div style="padding:1rem" class="text-danger">@_loadError</div>
|
|
}
|
|
else if (_roots.Count == 0)
|
|
{
|
|
<div style="padding:1rem" class="text-muted">No clusters yet.</div>
|
|
}
|
|
else
|
|
{
|
|
<div style="padding:.5rem 1rem">
|
|
<RawTree Roots="_roots" />
|
|
</div>
|
|
}
|
|
</section>
|
|
</PageErrorBoundary>
|
|
|
|
@code {
|
|
private IReadOnlyList<RawNode> _roots = Array.Empty<RawNode>();
|
|
private bool _loading = true;
|
|
private string? _loadError;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
_roots = await Svc.LoadRootsAsync();
|
|
// Auto-expand the Enterprise roots so the Cluster level (which owns the lazy plumbing) is
|
|
// visible on load, mirroring GlobalUns.ExpandStructural. Enterprise children (clusters) are
|
|
// eagerly materialised by LoadRootsAsync, so this needs no lazy fetch; clusters stay
|
|
// collapsed and load their folders/drivers on first expand.
|
|
foreach (var enterprise in _roots)
|
|
enterprise.Expanded = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_loadError = $"Failed to load the Raw tree: {ex.Message}";
|
|
}
|
|
finally
|
|
{
|
|
_loading = false;
|
|
}
|
|
}
|
|
}
|