diff --git a/components/ui-theme/validation/scadabridge-ui/README.md b/components/ui-theme/validation/scadabridge-ui/README.md new file mode 100644 index 0000000..edbf514 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/README.md @@ -0,0 +1,20 @@ +# ScadaBridge component validation host + +Disposable localhost-only host retained for reviewed ScadaBridge UI batches through consumer commit `d370dbd3`. It renders actual CentralUI components through a project reference and delivered Theme1.0.1/Secrets.Ui1.0.1/Secrets.Abstractions0.6.6. Historical G1 canary files and acceptance remain separate under theme-1.0.0; this host does not redefine that baseline. + +The default project-reference path is the user-authorized `/Users/dohertj2/Desktop/ScadaBridge` checkout. Override MSBuild `ScadaBridgeRoot` when reproducing elsewhere. `Program.cs` exposes `/canary-provenance`, rejects authentication writes, and registers synthetic read projections/rejecting mutation proxies. There is no database, Akka actor system, fleet, LDAP or COM service connection. Query-string `role` values are synthetic local principals evaluated by real UI policies, not application authentication or every-route authorization acceptance. Secrets metadata has no value/ciphertext; value reads, encryption, audit and writes reject calls. + +```sh +dotnet restore components/ui-theme/validation/scadabridge-ui/host/ScadaBridgeUiCanary.csproj --artifacts-path /tmp/scadabridge-ui-chapter-artifacts --packages /tmp/scadabridge-secrets101-official-packages --no-http-cache +dotnet run --project components/ui-theme/validation/scadabridge-ui/host/ScadaBridgeUiCanary.csproj --no-restore --artifacts-path /tmp/scadabridge-ui-chapter-artifacts --no-launch-profile --urls http://127.0.0.1:5201 +``` + +Use the configured approved NuGet feeds. Do not put credentials into this folder. Port5201 was coordinated for this task; choose a free loopback port for future concurrent fixtures and update the script origin. Never stop another task's listener. + +Routes include `/overlays`, `/form-samples`, `/batch-two?sample=dashboard`, `/presentation`, `/operations-canary?role=Viewer`, `/topology-canary?role=Deployer`, and `/secrets-canary?role=secrets-manager`. Source/page notices identify illustrative observations. MainLayout/site.css are the actual consumer authority, including its supported-dark adapter; canary CSS does not supply an alternate dark palette. App.razor copies the existing consumer pre-hydration preference script exactly for isolated script-behavior checks. + +ScadaBridge's `docs/ui-consistency/ScadaBridge-verification.md` and `evidence/sb01-03`, `sb04-06`, `sb07-09`, `sb10-12`, `sb13-15` retain real commands, raw failing measurements, corrected checks, package/runtime hashes, TRX and screenshots. In particular, early requested-dark/coarse and immediate pre-scroll/pre-Clear measurements were not accepted as successes. Final logical acceptance references their focused corrections explicitly. + +Browser scripts live in the ScadaBridge checkout's `infra/tools`. They use separate Python Playwright Chromium contexts and the retained real-browser zoom helper (`theme-1.0.0/canary/browser_zoom.py`), never the shared MCP tab. Real200% zoom must record720 CSS pixels/DPR2 for a1440 viewport; use viewport screenshots. Verify actual `pointer:coarse`/maxTouchPoints rather than trusting a requested touch context; native CDP touch emulation supplied verified contexts where Chromium initially reported a fine pointer. Await actual interactive state and native smooth scrolling before measuring. + +The source baseline covers44 page components/57 route declarations plus the shared Secrets package route; browser acceptance is representative actual components, not a claim that every route ran in a complete deployed host. Production legacy-name/tombstone inventory, legacy exact-target DIM restrictions and deployment remain rollout limits. No production scan or deployment is authorized by this fixture. diff --git a/components/ui-theme/validation/scadabridge-ui/host/BatchThreeFixtures.cs b/components/ui-theme/validation/scadabridge-ui/host/BatchThreeFixtures.cs new file mode 100644 index 0000000..7b4f289 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/BatchThreeFixtures.cs @@ -0,0 +1,86 @@ +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using ZB.MOM.WW.ScadaBridge.CentralUI.Services; +using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories; +using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services; +using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Transport; +using ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites; +using ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances; +using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates; +using ZB.MOM.WW.ScadaBridge.Commons.Messages.Health; +using ZB.MOM.WW.ScadaBridge.Commons.Messages.Notification; +using ZB.MOM.WW.ScadaBridge.Commons.Messages.Audit; +using ZB.MOM.WW.ScadaBridge.Commons.Types.Audit; +using ZB.MOM.WW.ScadaBridge.Commons.Types; +using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums; +using ZB.MOM.WW.ScadaBridge.Communication; +using ZB.MOM.WW.ScadaBridge.DeploymentManager; +using ZB.MOM.WW.ScadaBridge.DeploymentManager.PendingUpdates; +using ZB.MOM.WW.ScadaBridge.HealthMonitoring; +using ZB.MOM.WW.ScadaBridge.TemplateEngine.Services; +using ZB.MOM.WW.ScadaBridge.TemplateEngine.Flattening; + +// Disposable read-only synthetic projections. Real service constructors are resolved but never +// receive an actor system or a database. Every mutation and external probe remains rejected. +internal static class BatchThreeFixtures +{ + public static void Register(IServiceCollection services) + { + var sites = Enumerable.Range(1, 12).Select(i => new Site($"Synthetic facility {i:00} with a deliberately long local display name", $"fixture-{i:00}") { Id = i }).ToArray(); + services.AddScoped(_ => ReadOnlyFixtureProxy.WithReads(new Dictionary> + { + ["GetAllSitesAsync"] = _ => Task.FromResult>(sites), + ["GetAllDataConnectionsAsync"] = _ => Task.FromResult>([]) + })); + services.AddScoped(_ => ReadOnlyFixtureProxy.WithReads(new Dictionary> + { + ["GetAllTemplatesAsync"] = _ => Task.FromResult>([]), + ["GetTemplateStubsAsync"] = _ => Task.FromResult>([]), + ["GetAreasBySiteIdAsync"] = args => Task.FromResult>(Enumerable.Range(1, 6).Select(i => new Area($"Synthetic area {i:00} with a long inspection label") { Id = (int)args[0]! * 100 + i, SiteId = (int)args[0]! }).ToArray()), + ["GetTopologyInstancesAsync"] = _ => Task.FromResult>([]) + })); + services.AddScoped(); + services.AddScoped(); + services.AddSingleton(new EmptyPending()); + services.AddSingleton(new SyntheticKpis()); + var now = DateTimeOffset.UtcNow; + SiteHealthReport Report(string id) => new(id, 1, now, new Dictionary(), new Dictionary(), 0, 0, new Dictionary(), 0, 0, 0, 0); + var states = new Dictionary + { + ["healthy"] = new() { SiteId="healthy", IsOnline=true, LatestReport=Report("healthy"), LastReportReceivedAt=now, LastHeartbeatAt=now }, + ["offline"] = new() { SiteId="offline", IsOnline=false, LatestReport=Report("offline"), LastReportReceivedAt=now.AddMinutes(-8), LastHeartbeatAt=now.AddMinutes(-8) }, + ["warning"] = new() { SiteId="warning", IsOnline=true, IsMetricsStale=true, LatestReport=Report("warning"), LastReportReceivedAt=now.AddMinutes(-4), LastHeartbeatAt=now }, + ["unknown"] = new() { SiteId="unknown", IsOnline=true, LastHeartbeatAt=now } + }; + services.AddSingleton(ReadOnlyFixtureProxy.WithReads(new Dictionary> { ["GetAllSiteStates"] = _ => states })); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(Options.Create(new HealthMonitoringOptions())); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(new CommunicationService(Options.Create(new CommunicationOptions()), NullLogger.Instance)); + services.AddSingleton(new OperationLockManager()); + services.AddSingleton(Options.Create(new DeploymentManagerOptions())); + services.AddSingleton(Options.Create(new CommunicationOptions())); + services.AddSingleton>(NullLogger.Instance); + services.AddScoped(); services.AddScoped(); + services.AddSingleton(new DeploymentStatusNotifier(NullLogger.Instance)); + services.AddScoped(); services.AddScoped(); services.AddScoped(); + } + private sealed class EmptyPending : IPendingUpdatesCache + { + public event Action? Invalidated { add { } remove { } } + public Task GetAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new PendingUpdatesSnapshot(DateTimeOffset.UtcNow, [])); + } + private sealed class SyntheticKpis : IKpiSnapshotCache + { + public Task GetNotificationKpisAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new NotificationKpiResponse("local", true, null, 2, 0, 0, 4, null)); + public Task GetPerSiteNotificationKpisAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new PerSiteNotificationKpiResponse("local", true, null, [])); + public Task GetPerNodeNotificationKpisAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new PerNodeNotificationKpiResponse("local", true, null, [])); + public Task GetSiteCallKpisAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new SiteCallKpiResponse("local", true, null, 0, 0, 0, 2, null, 0)); + public Task GetPerNodeSiteCallKpisAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new PerNodeSiteCallKpiResponse("local", true, null, [])); + public Task GetAuditKpiSnapshotAsync(bool forceRefresh=false, CancellationToken cancellationToken=default) => Task.FromResult(new AuditLogKpiSnapshot(3, 0, 0, DateTime.UtcNow)); + } +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/App.before.razor.txt b/components/ui-theme/validation/scadabridge-ui/host/Components/App.before.razor.txt new file mode 100644 index 0000000..532689b --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/App.before.razor.txt @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/App.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/App.razor new file mode 100644 index 0000000..4352f29 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/App.razor @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/AccentCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/AccentCanary.razor new file mode 100644 index 0000000..d71eebe --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/AccentCanary.razor @@ -0,0 +1,41 @@ +@page "/accent" +Four-family accent component canary +

Four-family accent component canary

+

Fixture-only shared components under the actual CentralUI stylesheet. These four cases use the release-decision table and validate the shared light scheme, not a full sister application.

+ + + + +

@Selected.Label

+

An actual theme-styled link

+
+ Local primary action + Local ghost action + Disabled primary action +
+ Independent semantic information +

Synthetic local clicks: @_clicks

+
+
+@code { + [SupplyParameterFromQuery(Name = "family")] public string? Family { get; set; } + private int _clicks; + private void CountClick() => _clicks++; + private AccentCase Selected => Family?.ToLowerInvariant() switch + { + "historian" => new("Historian green", "#2f855a", "#1c6540", "#edf5f0", "#bddbc9"), + "btdb" => new("BTDB teal", "#1b7f8e", "#125764", "#eaf5f6", "#b7d9dd"), + "overview" => new("Overview purple", "#6d28d9", "#4c1d95", "#f2ecfc", "#d7c5f2"), + _ => new("Default blue", "#2f5fd0", "#1e3f99", "#eef2fc", "#cdd9f7") + }; + private sealed record AccentCase(string Label, string Accent, string Deep, string Tint, string Border); +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/BatchTwoCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/BatchTwoCanary.razor new file mode 100644 index 0000000..1c9b96b --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/BatchTwoCanary.razor @@ -0,0 +1,27 @@ +@page "/batch-two" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +@using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Audit +@using ZB.MOM.WW.ScadaBridge.Commons.Types.Audit +@if (Sample == "dashboard") {

Local state and UTC verification

} else {

Local state and UTC verification

} +

Actual components, synthetic read-only dependencies; no backend queries or write operations. Direct composition is not application authorization verification.

+@if (Sample == "dashboard") +{ + +} +else if (Sample == "toast") +{ + + +} +else +{ + + @_result +} +@code { + [SupplyParameterFromQuery] public string? Sample { get; set; } + private ToastNotification? _toast; + private string _result = "No local filter applied"; + private void Capture(AuditLogQueryFilter filter) => _result = $"From={filter.FromUtc:O};To={filter.ToUtc:O};FromKind={filter.FromUtc?.Kind};ToKind={filter.ToUtc?.Kind}"; + private void ShowToast() { _toast!.ShowError("Synthetic save feedback", "Local configuration", 60000); _toast.ShowInfo("Synthetic read feedback", "Local audit query", 60000); } +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/Canary.before.razor.txt b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/Canary.before.razor.txt new file mode 100644 index 0000000..f9eecfc --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/Canary.before.razor.txt @@ -0,0 +1,20 @@ +@page "/" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +@inject IDialogService Dialogs +ScadaBridge local component canary +

ScadaBridge local component canary

+

Actual CentralUI MainLayout, DateTimeRangeFilter, LoadingSpinner and DialogHost with synthetic local content. This is not the complete application.

+

Actual CentralUI login · Fixture provenance

+
+
Synthetic local filter
+
+ + +

These controls have no fleet service behind them.

+ Open local confirmation +
+
+@code { + private async Task ShowDialog() => await Dialogs.ConfirmAsync( + "Local fixture confirmation", "Synthetic dialog. Confirm and Cancel only dismiss this local fixture."); +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/Canary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/Canary.razor new file mode 100644 index 0000000..cc45b1f --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/Canary.razor @@ -0,0 +1,61 @@ +@page "/" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +@inject IDialogService Dialogs +ScadaBridge local component canary +

ScadaBridge local component canary

+

Actual CentralUI MainLayout, DateTimeRangeFilter, LoadingSpinner and DialogHost with synthetic local content. This is not the complete application.

+

Actual CentralUI login · Fixture provenance

+
+
Synthetic local filter
+
+ + +

These controls have no fleet service behind them.

+ + + +
+ OK sample + Warning sample + Failure sample + Idle sample + Information sample +
+
+ Save local sample + Simulate local failure + Caller-disabled local action + Open local confirmation +
+
@_outcome
+

Supported dark tokens come from actual CentralUI site.css under the limited candidate adoption; this host still uses synthetic local data only.

+
+
+@code { + private string _sample = ""; + private string? _fieldError = "Synthetic validation error. Enter a label to clear it."; + private string? _workingAction; + private string _outcome = "No local operation has run."; + private bool IsWorking => _workingAction is not null; + private bool SuccessBusy => _workingAction == "success"; + private bool FailureBusy => _workingAction == "failure"; + private string FieldDescription => _fieldError is null + ? "canary-field-hint" : "canary-field-hint canary-field-error"; + private void ValidateSample() => _fieldError = string.IsNullOrWhiteSpace(_sample) + ? "Synthetic validation error. Enter a label to clear it." : null; + private async Task WorkAsync(bool failure) + { + if (IsWorking) return; + _workingAction = failure ? "failure" : "success"; + _outcome = "Local sample pending."; + await Task.Delay(800); + _outcome = failure ? "Local sample failed. Try again." : "Local sample saved."; + _workingAction = null; + } + private async Task ShowDialog() => await Dialogs.ConfirmAsync( + "Local fixture confirmation", "Synthetic dialog. Confirm and Cancel only dismiss this local fixture."); +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/FormsCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/FormsCanary.razor new file mode 100644 index 0000000..11f2568 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/FormsCanary.razor @@ -0,0 +1,44 @@ +@page "/form-samples" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +@using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Forms +@using ZB.MOM.WW.ScadaBridge.Commons.Types.DataConnections +@if (View is "sms" or "smtp") {

Local form association samples

} else {

Local form association samples

} +

Actual consumer components with synthetic local values. Empty repository reads only; all repository mutations are rejected. Direct notification component composition is not application authorization verification.

+@if (View == "sms") +{ + +} +else if (View == "smtp") +{ + +} +else +{ +
+ + +
+
+

Repeated parameter editors

+ + +
+
+

Transport selection component

+ + @node + +
+
+

Actual JSON editor

+ +
+} +@code { + [SupplyParameterFromQuery] public string? View { get; set; } + private readonly MxGatewayEndpointConfig _primary = new(); + private readonly MxGatewayEndpointConfig _backup = new(); + private readonly string[] _nodes = ["Plant A configuration", "Plant B configuration"]; + private const string _schema = """{"type":"object","properties":{"count":{"type":"integer"},"details":{"type":"object","properties":{"name":{"type":"string"}}}}}"""; +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/LoginCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/LoginCanary.razor new file mode 100644 index 0000000..f5ee6d2 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/LoginCanary.razor @@ -0,0 +1,3 @@ +@page "/login" +ScadaBridge actual login component canary + diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/OperationsCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/OperationsCanary.razor new file mode 100644 index 0000000..0a5be19 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/OperationsCanary.razor @@ -0,0 +1,4 @@ +@page "/operations-canary" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +

Local synthetic observations only. No database, actor system, LDAP or fleet is connected.

+ diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/OverlayCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/OverlayCanary.razor new file mode 100644 index 0000000..71c2b25 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/OverlayCanary.razor @@ -0,0 +1,20 @@ +@page "/overlays" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +@using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Audit +@using ZB.MOM.WW.ScadaBridge.CentralUI.Services +@using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums +@inject IDialogService Dialogs +

Local overlay verification

+

Actual CentralUI dialogs and audit drawer, synthetic read-only data. No fleet services.

+ + + +
@_result
+ +@code { + private bool _drawer; + private string _result = "No local action"; + private readonly AuditEventView _event = new() { EventId = Guid.Parse("11111111-2222-3333-4444-555555555555"), OccurredAtUtc = DateTime.UtcNow, IngestedAtUtc = DateTime.UtcNow, Channel = AuditChannel.ApiOutbound, Kind = AuditKind.ApiCall, Status = AuditStatus.Delivered, SourceSiteId = "local-sample", Actor = "local-fixture", Target = "synthetic" }; + private async Task Confirm() => _result = await Dialogs.ConfirmAsync("Local confirmation", "Synthetic confirmation body") ? "Confirmed locally" : "Cancelled locally"; + private async Task Prompt() => _result = await Dialogs.PromptAsync("Local prompt", "Local sample value") ?? "Cancelled locally"; +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/PresentationCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/PresentationCanary.razor new file mode 100644 index 0000000..a41ac5f --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/PresentationCanary.razor @@ -0,0 +1,26 @@ +@page "/presentation" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +@using ZB.MOM.WW.ScadaBridge.Commons.Types.Debugging +@using ZB.MOM.WW.ScadaBridge.ScriptAnalysis +

Local flow and table presentation samples

+

Actual flow/list/table components, synthetic outcomes and long values only. No live/replay command or backend is called.

+
+ Successful sample · Warning sample · + Failure sample · Information sample · + Muted sample · Secondary sample +
+ + + + Synthetic identifierDetails + @item@LongValue + +@code { + private static readonly string LongValue = "synthetic.identifier." + new string('x', 200); + private readonly string[] _items = ["Plant A", "Plant B"]; + private static readonly FlowStep[] Steps = Enum.GetValues().Select((outcome, i) => new FlowStep(Guid.NewGuid(), null, null, + FlowStepKind.ApiCall, FlowLane.Site, "Synthetic " + outcome, "Illustrative outcome", DateTimeOffset.UnixEpoch.AddSeconds(i), i * 10, outcome, + null, null, null, "local", null, null, null, null)).ToArray(); + private readonly PredictedFlow _prediction = new([new PredictedNode("ghost", FlowStepKind.ScriptRun, FlowLane.Site, "Synthetic predicted-only branch", false, "Not observed in this synthetic run")], []); + private readonly FlowGraph _graph = new(Steps, Steps.Zip(Steps.Skip(1)).Select(pair => new FlowEdge(pair.First.EventId, pair.Second.EventId, false, false)).ToArray(), false, false); +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/SecretsCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/SecretsCanary.razor new file mode 100644 index 0000000..8f2d5a2 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/SecretsCanary.razor @@ -0,0 +1,4 @@ +@page "/secrets-canary" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +

Actual delivered Secrets UI in ScadaBridge shell. Synthetic metadata only; value reads, encryption, audit and all writes are rejected.

+ diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/TopologyCanary.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/TopologyCanary.razor new file mode 100644 index 0000000..5b97fe6 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Pages/TopologyCanary.razor @@ -0,0 +1,4 @@ +@page "/topology-canary" +@layout ZB.MOM.WW.ScadaBridge.CentralUI.Components.Layout.MainLayout +

Local synthetic sites and areas only. Load/search/selection can be inspected; deployment and mutation services reject writes.

+ diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/Routes.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/Routes.razor new file mode 100644 index 0000000..dcc99d4 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/Routes.razor @@ -0,0 +1,4 @@ + + +

Canary route not found

+
diff --git a/components/ui-theme/validation/scadabridge-ui/host/Components/_Imports.razor b/components/ui-theme/validation/scadabridge-ui/host/Components/_Imports.razor new file mode 100644 index 0000000..872dde9 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Components/_Imports.razor @@ -0,0 +1,6 @@ +@using Microsoft.AspNetCore.Components +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using ZB.MOM.WW.Theme +@using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared diff --git a/components/ui-theme/validation/scadabridge-ui/host/Program.cs b/components/ui-theme/validation/scadabridge-ui/host/Program.cs new file mode 100644 index 0000000..ed7dd16 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/Program.cs @@ -0,0 +1,61 @@ +using System.Security.Claims; +using Microsoft.AspNetCore.DataProtection; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.Extensions.FileProviders; +using ScadaBridgeUiCanary.Components; +using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared; +using ZB.MOM.WW.Theme; + +var builder = WebApplication.CreateBuilder(args); +builder.WebHost.UseStaticWebAssets(); +builder.Services.AddRazorComponents().AddInteractiveServerComponents(); +builder.Services.AddDataProtection().UseEphemeralDataProtectionProvider(); +builder.Services.AddAuthorizationCore(options => ZB.MOM.WW.Secrets.Ui.SecretsAuthorization.AddSecretsAuthorization(options)); +ZB.MOM.WW.ScadaBridge.Security.AuthorizationPolicies.AddScadaBridgeAuthorization(builder.Services); +builder.Services.AddCascadingAuthenticationState(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); +builder.Services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); +builder.Services.AddScoped(_ => ReadOnlyFixtureProxy.EmptyReads()); +builder.Services.AddScoped(_ => ReadOnlyFixtureProxy.EmptyReads()); +builder.Services.AddScoped(_ => ReadOnlyFixtureProxy.EmptyReads("ListAsync")); +builder.Services.AddScoped(_ => ReadOnlyFixtureProxy.EmptyReads()); +BatchThreeFixtures.Register(builder.Services); +SecretsCanaryFixtures.Register(builder.Services); +var app = builder.Build(); +app.UseStaticFiles(new StaticFileOptions +{ + FileProvider = new PhysicalFileProvider(Path.Combine( + builder.Configuration["Canary:ScadaBridgeRoot"] ?? "/Users/dohertj2/Desktop/ScadaBridge", + "src/ZB.MOM.WW.ScadaBridge.Host/wwwroot")) +}); +app.UseStaticFiles(); +app.UseAntiforgery(); +app.MapGet("/canary-provenance", () => new +{ + purpose = "Disposable local component canary; not the complete ScadaBridge application", + themeAssembly = typeof(ThemeShell).Assembly.GetName().Version?.ToString(), + centralUiAssembly = typeof(DialogHost).Assembly.GetName().Version?.ToString(), + data = "Synthetic local only; no SQL, Akka, LDAP or fleet services registered", + source = "Authorized ScadaBridge checkout via project reference" +}); +app.MapGet("/auth/ping", () => Results.Ok()); +app.MapPost("/auth/activity", () => Results.NoContent()); +app.MapPost("/auth/login", () => Results.StatusCode(405)); +app.MapPost("/auth/logout", () => Results.StatusCode(405)); +app.MapRazorComponents().AddInteractiveServerRenderMode(); +app.Run(); + +internal sealed class LocalAnonymousState(Microsoft.AspNetCore.Components.NavigationManager navigation) : AuthenticationStateProvider +{ + public override Task GetAuthenticationStateAsync() + { + // Fixture-only role selection. No real authentication endpoint or external identity is used. + var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(new Uri(navigation.Uri).Query); + var roles = query.TryGetValue("role", out var value) ? value.ToString().Split(',') : []; + var claims = roles.Select(role => new Claim(ZB.MOM.WW.ScadaBridge.Security.JwtTokenService.RoleClaimType, role)).ToList(); + claims.Add(new Claim(ZB.MOM.WW.ScadaBridge.Security.JwtTokenService.UsernameClaimType, "local synthetic identity")); + return Task.FromResult(new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity(claims, roles.Length > 0 ? "LocalFixture" : null)))); + } +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/ReadOnlyFixtureProxy.cs b/components/ui-theme/validation/scadabridge-ui/host/ReadOnlyFixtureProxy.cs new file mode 100644 index 0000000..949c73b --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/ReadOnlyFixtureProxy.cs @@ -0,0 +1,46 @@ +using System.Reflection; +// Fixture-only empty reads. Every non-Get call is rejected, including writes, +// endpoint verification, certificate trust and notification sending. +public class ReadOnlyFixtureProxy : DispatchProxy +{ + private string? _failOnceMethod; + private IReadOnlyDictionary>? _reads; + public static T WithReads(IReadOnlyDictionary> reads) where T : class + { + var proxy = Create(); + ((ReadOnlyFixtureProxy)(object)proxy)._reads = reads; + return proxy; + } + public static T EmptyReads(string? failOnceMethod = null) where T : class + { + var proxy = Create(); + ((ReadOnlyFixtureProxy)(object)proxy)._failOnceMethod = failOnceMethod; + return proxy; + } + protected override object? Invoke(MethodInfo? method, object?[]? args) + { + if (method is not null && _reads?.TryGetValue(method.Name, out var read) == true) + return read(args ?? []); + if (method is null || (!method.Name.StartsWith("Get", StringComparison.Ordinal) && method.Name != "ListAsync")) + throw new InvalidOperationException("Local fixture rejects non-read operations."); + if (method.Name == _failOnceMethod) + { + _failOnceMethod = null; + throw new InvalidOperationException("Synthetic local read failure; retry is safe."); + } + var result = method.ReturnType; + if (!result.IsGenericType || result.GetGenericTypeDefinition() != typeof(Task<>)) + throw new InvalidOperationException("Unsupported fixture read shape."); + var valueType = result.GenericTypeArguments[0]; + object? value = valueType.IsValueType ? Activator.CreateInstance(valueType) : null; + if (valueType.IsGenericType) + { + var shape = valueType.GetGenericTypeDefinition(); + if (shape == typeof(IReadOnlyList<>) || shape == typeof(IList<>) || shape == typeof(IEnumerable<>)) + value = Activator.CreateInstance(typeof(List<>).MakeGenericType(valueType.GenericTypeArguments)); + else if (shape == typeof(IReadOnlyDictionary<,>) || shape == typeof(IDictionary<,>)) + value = Activator.CreateInstance(typeof(Dictionary<,>).MakeGenericType(valueType.GenericTypeArguments)); + } + return typeof(Task).GetMethod(nameof(Task.FromResult))!.MakeGenericMethod(valueType).Invoke(null, new[] { value }); + } +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/ScadaBridgeUiCanary.csproj b/components/ui-theme/validation/scadabridge-ui/host/ScadaBridgeUiCanary.csproj new file mode 100644 index 0000000..03df66a --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/ScadaBridgeUiCanary.csproj @@ -0,0 +1,13 @@ + + + net10.0 + enable + enable + /Users/dohertj2/Desktop/ScadaBridge + 1.0.1 + + + + + + diff --git a/components/ui-theme/validation/scadabridge-ui/host/SecretsCanaryFixtures.cs b/components/ui-theme/validation/scadabridge-ui/host/SecretsCanaryFixtures.cs new file mode 100644 index 0000000..e8c6202 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/SecretsCanaryFixtures.cs @@ -0,0 +1,20 @@ +using ZB.MOM.WW.Secrets.Abstractions; +using ZB.MOM.WW.Audit; +internal static class SecretsCanaryFixtures +{ + public static void Register(IServiceCollection services) + { + IReadOnlyList metadata = new[] { "fixture/alpha", "fixture/" + new string('x', 400) }.Select(name => new SecretMetadata + { + Name = new SecretName(name), Description = "Synthetic local metadata", ContentType = SecretContentType.Text, + KekId = "synthetic-key-id", Revision = 1, CreatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z"), UpdatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z"), UpdatedBy = "synthetic reviewer" + }).ToArray(); + services.AddSingleton(ReadOnlyFixtureProxy.WithReads(new Dictionary> + { + ["ListAsync"] = _ => Task.FromResult(metadata), + ["GetAsync"] = _ => throw new InvalidOperationException("Local metadata canary rejects value reads.") + })); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads()); + } +} diff --git a/components/ui-theme/validation/scadabridge-ui/host/wwwroot/canary-adoption.css b/components/ui-theme/validation/scadabridge-ui/host/wwwroot/canary-adoption.css new file mode 100644 index 0000000..cef3a97 --- /dev/null +++ b/components/ui-theme/validation/scadabridge-ui/host/wwwroot/canary-adoption.css @@ -0,0 +1,9 @@ +/* Fixture layout only. Supported dark tokens now come from the actual CentralUI + site.css under the limited SB-01 candidate adoption; no fixture palette override. */ +html[data-canary="scadabridge"] .canary-action-row { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: .75rem; + margin-block: 1rem; +}