fix(admin-ui): harden simple modal field and pending lifecycles
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System.Reflection;
|
||||
using SimpleModalCanary.Components;
|
||||
using ZB.MOM.WW.OtOpcUa.AdminUI.Uns;
|
||||
var builder=WebApplication.CreateBuilder(args);builder.WebHost.UseStaticWebAssets();
|
||||
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
|
||||
builder.Services.AddSingleton<FixtureState>();
|
||||
builder.Services.AddSingleton<IUnsTreeService>(services=> {var proxy=DispatchProxy.Create<IUnsTreeService,SyntheticUnsProxy>();((SyntheticUnsProxy)(object)proxy).State=services.GetRequiredService<FixtureState>();return proxy;});
|
||||
var app=builder.Build();app.UseAntiforgery();app.MapStaticAssets();
|
||||
app.MapGet("/fixture/provenance",()=>new {purpose="Loopback synthetic simple modal fixture",backend="No DB, driver, gateway or operational service registration"});
|
||||
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();app.Run();
|
||||
public sealed class FixtureState { public int Operations; }
|
||||
public class SyntheticUnsProxy:DispatchProxy {
|
||||
public FixtureState State {get;set;}=null!;
|
||||
protected override object? Invoke(MethodInfo? method,object?[]? args) {
|
||||
if(method?.Name is not ("CreateAreaAsync" or "CreateLineAsync"))throw new InvalidOperationException("Operation refused: "+method?.Name);
|
||||
State.Operations++;return Complete();
|
||||
}
|
||||
private static async Task<UnsMutationResult> Complete(){await Task.Delay(600);return new(true,null);}
|
||||
}
|
||||
Reference in New Issue
Block a user