fix(adminui): stale-open guards, validation summaries, key-delete confirm, error boundary (#604)
Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@inherits LayoutComponentBase
|
||||
@implements IDisposable
|
||||
@using System.Security.Claims
|
||||
|
||||
@* Thin delegation to the shared ZB.MOM.WW.Theme side-rail chassis. ThemeShell owns
|
||||
@@ -69,5 +70,34 @@
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</RailFooter>
|
||||
<ChildContent>@Body</ChildContent>
|
||||
<ChildContent>
|
||||
@* A throwing page would otherwise kill the whole circuit (blank "reload" bar). The boundary
|
||||
confines it to the page body and offers Recover; navigating away also recovers it. It does NOT
|
||||
catch exceptions from async-void handlers or timer callbacks. *@
|
||||
<ErrorBoundary @ref="_boundary">
|
||||
<ChildContent>@Body</ChildContent>
|
||||
<ErrorContent Context="ex">
|
||||
<div class="alert alert-danger m-3" role="alert">
|
||||
<strong>This page hit an unexpected error.</strong>
|
||||
<div class="small mono mt-1">@ex.GetType().Name: @ex.Message</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger mt-2" @onclick="() => _boundary?.Recover()">Try again</button>
|
||||
</div>
|
||||
</ErrorContent>
|
||||
</ErrorBoundary>
|
||||
</ChildContent>
|
||||
</ThemeShell>
|
||||
|
||||
@code {
|
||||
private ErrorBoundary? _boundary;
|
||||
|
||||
[Inject] private NavigationManager Nav { get; set; } = default!;
|
||||
|
||||
protected override void OnInitialized() => Nav.LocationChanged += OnLocationChanged;
|
||||
|
||||
// A fresh navigation clears a tripped boundary so the next page isn't stuck behind the old error.
|
||||
private void OnLocationChanged(object? sender, Microsoft.AspNetCore.Components.Routing.LocationChangedEventArgs e)
|
||||
=> _boundary?.Recover();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose() => Nav.LocationChanged -= OnLocationChanged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user