feat(dashboard): make Galaxy browse and watch accessible

This commit is contained in:
Joseph Doherty
2026-11-13 18:19:08 -05:00
parent 5a1daab9ce
commit c9a6c31cb8
41 changed files with 1087 additions and 31 deletions
@@ -0,0 +1,5 @@
@namespace MxUiCanary.Components
@page "/browse-fixture"
@inject IJSRuntime JS
<ThemeShell Product="Synthetic MX browse"><ChildContent><p>Synthetic cached Galaxy and redacted fixture values. No COM or worker.</p><BrowsePage/></ChildContent></ThemeShell>
@code { protected override async Task OnAfterRenderAsync(bool firstRender){if(firstRender)await JS.InvokeVoidAsync("mxCanaryReady");} }
@@ -1,2 +1,2 @@
@namespace MxUiCanary.Components
<!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="/lib/bootstrap/css/bootstrap.min.css"/><ThemeHead/><link rel="stylesheet" href="/css/site.css"/></head><body class="dashboard-body"><FixtureBody @rendermode="InteractiveServer"/><script>window.mxCanaryReady=()=>document.documentElement.dataset.mxReady='true';</script><script src="/_framework/blazor.web.js"></script></body></html>
<!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="/lib/bootstrap/css/bootstrap.min.css"/><ThemeHead/><link rel="stylesheet" href="/css/site.css"/><HeadOutlet @rendermode="InteractiveServer"/></head><body class="dashboard-body"><FixtureRoutes @rendermode="InteractiveServer"/><script>window.mxCanaryReady=()=>document.documentElement.dataset.mxReady='true';</script><script src="/_framework/blazor.web.js"></script></body></html>
@@ -0,0 +1,2 @@
@namespace MxUiCanary.Components
<Router AppAssembly="typeof(FixtureRoutes).Assembly"><Found Context="route"><RouteView RouteData="route"/></Found></Router>
@@ -5,3 +5,5 @@
@using ZB.MOM.WW.Theme
@using ZB.MOM.WW.MxGateway.Server.Dashboard.Components.Shared
@using ZB.MOM.WW.MxGateway.Server.Dashboard.Components.Pages
@using Microsoft.AspNetCore.Components.Routing
+30 -1
View File
@@ -102,4 +102,33 @@ using ZB.MOM.WW.MxGateway.Server.Security.Authorization;
authenticationType: "test",
nameType: ClaimTypes.Name,
roleType: ClaimTypes.Role))));
}
}
// In-memory Galaxy projection and read-only fake values for the actual BrowsePage.
internal sealed class FixtureGalaxyCache : ZB.MOM.WW.GalaxyRepository.IGalaxyHierarchyCache
{
public ZB.MOM.WW.GalaxyRepository.GalaxyHierarchyCacheEntry Current { get; }
public FixtureGalaxyCache()
{
var plant = new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject { GobjectId = 1, TagName = "SyntheticPlant", BrowseName = "SyntheticPlant", IsArea = true };
var pump = new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject { GobjectId = 2, ParentGobjectId = 1, TagName = "Pump01", BrowseName = "Pump01" };
pump.Attributes.Add(new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyAttribute { AttributeName = "PV", FullTagReference = "Pump01.PV", DataTypeName = "Float" });
pump.Attributes.Add(new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyAttribute { AttributeName = new string('x', 200), FullTagReference = "Pump01." + new string('x', 200), DataTypeName = "Float" });
var sibling = new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject { GobjectId = 3, ParentGobjectId = 1, TagName = "Sibling01", BrowseName = "Sibling01" };
sibling.Attributes.Add(new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyAttribute { AttributeName = "PV", FullTagReference = "Sibling01.PV", DataTypeName = "Float" });
ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject[] rows = [plant, pump, sibling];
Current = ZB.MOM.WW.GalaxyRepository.GalaxyHierarchyCacheEntry.Empty with {
Status = ZB.MOM.WW.GalaxyRepository.GalaxyCacheStatus.Healthy, Sequence = 1,
Objects = rows, Index = ZB.MOM.WW.GalaxyRepository.GalaxyHierarchyIndex.Build(rows), ObjectCount = rows.Length, AttributeCount = 3,
LastSuccessAt = DateTimeOffset.UtcNow,
};
}
public Task RefreshAsync(CancellationToken cancellationToken) => Task.CompletedTask;
public Task WaitForFirstLoadAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
internal sealed class FixtureLiveData : IDashboardLiveDataService
{
public Task<DashboardLiveReadResult> ReadAsync(IReadOnlyCollection<string> tagAddresses, CancellationToken cancellationToken) =>
Task.FromResult(new DashboardLiveReadResult(tagAddresses.Select(tag => new DashboardTagValue(tag, true, "[redacted]", "Float", 192, true, DateTimeOffset.UnixEpoch, null)).ToArray(), null, "synthetic-no-worker", null));
public Task<DashboardAlarmQueryResult> QueryAlarmsAsync(CancellationToken cancellationToken) =>
Task.FromResult(new DashboardAlarmQueryResult([], null, null));
}
+6
View File
@@ -10,6 +10,12 @@ builder.Services.AddSingleton<IDashboardSnapshotService, StubSnapshotService>();
builder.Services.AddSingleton<IDashboardSnapshotFeed, IdleSnapshotFeed>();
builder.Services.AddSingleton<IDashboardApiKeyManagementService, ManagingApiKeyService>();
builder.Services.AddSingleton<AuthenticationStateProvider, StubAuthenticationStateProvider>();
builder.Services.AddSingleton<ZB.MOM.WW.GalaxyRepository.IGalaxyHierarchyCache, FixtureGalaxyCache>();
builder.Services.AddSingleton<IDashboardBrowseService, DashboardBrowseService>();
builder.Services.AddSingleton<IDashboardLiveDataService, FixtureLiveData>();
builder.Services.AddSingleton<ZB.MOM.WW.GalaxyRepository.IGalaxyDeployNotifier, ZB.MOM.WW.GalaxyRepository.GalaxyDeployNotifier>();
builder.Services.AddSingleton<DashboardBrowseSearchIndex>();
builder.Services.AddScoped<DashboardCircuitConnectionTracker>();
var app = builder.Build();
app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.GetFullPath("../../../src/ZB.MOM.WW.MxGateway.Server/wwwroot")) });
app.UseStaticFiles();app.UseAntiforgery();