Files
scadaproj/components/ui-theme/validation/ot-ui/host/Components/Pages/Pilot.razor
T

37 lines
2.7 KiB
Plaintext

@page "/"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
<h1>Local OtOpcUa UI verification</h1>
<p>Actual AdminUI components with synthetic local state. No database, fleet, browse session, protocol or write service is connected.</p>
@if (Sample == "log") { <ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.ScriptLog /> }
else if (Sample == "uns") { <ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Uns.GlobalUns /> }
else
{
<section id="standalone"><h2 class="h5">Standalone calculation form</h2><CalculationDriverForm /></section>
<section id="scoped"><h2 class="h5">Repeated form associations</h2>
<CascadingValue Value="_editContext"><CalculationDriverForm /><CalculationDriverForm /></CascadingValue></section>
<section><h2 class="h5">Synthetic UNS nodes</h2><UnsTree Roots="_roots" OnToggleExpand="Toggle" OnEdit="Edit" OnDelete="Edit" /></section>
<button id="open-confirm" class="btn btn-primary" @onclick="() => _confirmVisible=true">Open synthetic confirmation</button>
<button id="open-driver" class="btn btn-outline-secondary" @onclick="() => _driverVisible=true">Open local calculation driver</button>
<button id="open-two" class="btn btn-outline-secondary" @onclick="() => { _confirmVisible=true; _secondVisible=true; }">Attempt two local overlays</button>
<button id="show-toasts" class="btn btn-outline-secondary" @onclick="ShowToasts">Show local toasts</button>
<ToastNotification @ref="_toast" />
<output id="local-outcome">@_outcome</output>
<RawConfirmDialog @bind-Visible="_confirmVisible" Title="Delete synthetic driver" Message="Local test only. No service writes occur." OnConfirm="LocalSlowConfirm" />
<RawConfirmDialog @bind-Visible="_secondVisible" Title="Second synthetic dialog" Message="Rejected while another overlay is active." />
<DriverConfigModal @bind-Visible="_driverVisible" DriverType="Calculation" ClusterId="synthetic" />
}
@code {
[SupplyParameterFromQuery] public string? Sample { get; set; }
private ToastNotification? _toast;
private bool _secondVisible;
private void ShowToasts() { _toast!.ShowInfo("Synthetic local information", "Local information", 60000); _toast.ShowWarning("Synthetic local warning", "Local warning", 60000); }
private readonly EditContext _editContext = new(new object());
private bool _confirmVisible, _driverVisible;
private string _outcome = "No local action";
private readonly List<UnsNode> _roots = [new() { Kind=UnsNodeKind.Area, Key="area:local", DisplayName="Synthetic area", HasLazyChildren=true }];
private void Toggle(UnsNode node) => node.Expanded = !node.Expanded;
private void Edit(UnsNode node) => _outcome = "Local callback: " + node.Key;
private async Task LocalSlowConfirm() { await Task.Delay(700); _outcome = "Synthetic confirmation completed; no service called"; }
}