fix(admin-ui): harden read-only script source dialog lifecycle

This commit is contained in:
Joseph Doherty
2026-11-14 00:39:03 -05:00
parent ea5bb6a0bc
commit f953d230f8
34 changed files with 2125 additions and 48 deletions
@@ -0,0 +1,3 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><base href="/"/>
<link rel="stylesheet" href="_content/ZB.MOM.WW.OtOpcUa.AdminUI/lib/bootstrap/css/bootstrap.min.css"/><ThemeHead/><link rel="stylesheet" href="_content/ZB.MOM.WW.OtOpcUa.AdminUI/css/site.css"/>
</head><body><Fixture @rendermode="InteractiveServer"/><script src="_content/ZB.MOM.WW.OtOpcUa.AdminUI/js/dialog-focus.js"></script><script src="_framework/blazor.web.js"></script></body></html>
@@ -0,0 +1,15 @@
@page "/"
@implements IDisposable
@inject FixtureSession Session
@inject FixtureRegistry Registry
<main class="page">
<h1>Local read-only script source fixture</h1>
<div class="d-flex gap-2"><button type="button" id="hold" @onclick="()=>Session.HoldNext=true">Hold next synthetic read</button><button type="button" id="fail" @onclick="()=>Session.FailNext=true">Fail next synthetic read</button><button type="button" id="outside">Outside control</button></div>
<output id="ready">@(_ready?"ready":"loading")</output><output id="session">@Session.Id</output>
<AuthorizeView Policy="ConfigEditor"><Authorized>@if(!Session.PageRemoved){<Scripts/>}</Authorized><NotAuthorized><p>Access denied.</p></NotAuthorized></AuthorizeView>
</main>
@code{
private bool _ready;
protected override void OnAfterRender(bool firstRender){if(firstRender){Registry.Sessions.TryAdd(Session.Id,Session);Session.Changed=()=>InvokeAsync(StateHasChanged);_ready=true;StateHasChanged();}}
public void Dispose(){Session.Changed=null;Registry.Sessions.TryRemove(Session.Id,out _);}
}
@@ -0,0 +1,6 @@
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Web
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using ZB.MOM.WW.Theme
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages