Skip to content

Commit 8a8784b

Browse files
robgrameCopilot
andcommitted
feat(web.azure): port read-only pages (DeviceList, DeviceDetail, Audit, Settings) + WorkerStatusBadge
Phase 2 of the Web.Azure portal port. Mirrors the on-prem dashboard structure so operators see the same UI when looking at Azure SQL data. Pages ported (with minimal Azure adaptation): - /devices (DeviceList) — paginated/filtered consistency view - /devices/{id} (DeviceDetail) — keys comparison + admin-gated reveal that re-checks AdminOnly server-side, decrypts via DataKeyService, and audit-logs each reveal. - /audit (Audit) — paginated/filtered audit log + CSV export with spreadsheet-formula-injection neutralization. AdminOnly. - /settings (Settings) — RuntimeConfig editor + passphrase. AdminOnly. The on-prem "Run scan now" section is removed: the Azure deployment has no scan Worker yet, so the trigger would have no consumer. Layout / shell: - MainLayout.razor replaced with the on-prem sidebar layout (nav links gated by AuthorizeView AdminOnly / ViewerOrAdmin, sign-in/sign-out links, version). - Components/Shared/WorkerStatusBadge.razor — graceful degradation: when no Worker writes WorkerHeartbeats (the default on Azure today) the badge renders "Worker: nessun heartbeat" instead of red-alarming Offline. - Routes.razor — RouteView replaced with AuthorizeRouteView so the per-page [Authorize(Policy="AdminOnly")] attributes are actually enforced. - _Imports.razor — added Core.Security, Core.Services, Core.Services.Interfaces, Web.Azure.Components.Shared usings. - wwwroot/app.css — copied from on-prem (10 KB) so .dashboard-grid, .card, .badge, .filters, .worker-badge etc. render correctly. Build green (Azure solution: Shared, Core, HybridAgent, Web.Azure, Functions all built). Tests green: 86 Core + 8 HybridAgent + 15 Functions = 109 passed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2be4984 commit 8a8784b

12 files changed

Lines changed: 2024 additions & 300 deletions

File tree

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,44 @@
1-
@inherits LayoutComponentBase
1+
@inherits LayoutComponentBase
2+
@using System.Reflection
23

3-
<div class="page">
4-
<div class="sidebar">
5-
<NavMenu />
6-
</div>
7-
8-
<main>
9-
<div class="top-row px-4">
10-
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
4+
<div class="app-container">
5+
<nav class="sidebar">
6+
<div class="sidebar-header">
7+
<h2>🔐 BLK Monitor <small style="font-weight:normal;font-size:.7rem;color:#9aa">Azure</small></h2>
8+
</div>
9+
<ul class="nav-menu">
10+
<li><NavLink href="/" Match="NavLinkMatch.All">📊 Dashboard</NavLink></li>
11+
<AuthorizeView Policy="ViewerOrAdmin">
12+
<Authorized>
13+
<li><NavLink href="/devices">📋 Devices</NavLink></li>
14+
</Authorized>
15+
</AuthorizeView>
16+
<AuthorizeView Policy="AdminOnly">
17+
<Authorized>
18+
<li><NavLink href="/settings">⚙️ Settings</NavLink></li>
19+
<li><NavLink href="/audit">🔍 Audit</NavLink></li>
20+
</Authorized>
21+
</AuthorizeView>
22+
</ul>
23+
<div class="sidebar-footer">
24+
<AuthorizeView>
25+
<Authorized>
26+
<small class="sidebar-footer-user">👤 @context.User.Identity?.Name</small>
27+
<small><a href="MicrosoftIdentity/Account/SignOut" style="color:#9aa">Sign out</a></small>
28+
</Authorized>
29+
<NotAuthorized>
30+
<small><a href="MicrosoftIdentity/Account/SignIn" style="color:#9aa">Sign in</a></small>
31+
</NotAuthorized>
32+
</AuthorizeView>
33+
<small class="sidebar-footer-version" title="@_versionFull">v@_versionDisplay</small>
1134
</div>
35+
</nav>
1236

13-
<article class="content px-4">
14-
@Body
15-
</article>
37+
<main class="main-content">
38+
<header class="app-topbar">
39+
<WorkerStatusBadge @rendermode="InteractiveServer" />
40+
</header>
41+
@Body
1642
</main>
1743
</div>
1844

@@ -21,3 +47,14 @@
2147
<a href="." class="reload">Reload</a>
2248
<span class="dismiss">🗙</span>
2349
</div>
50+
51+
@code {
52+
private static readonly string _versionFull =
53+
typeof(MainLayout).Assembly
54+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
55+
?? typeof(MainLayout).Assembly.GetName().Version?.ToString()
56+
?? "unknown";
57+
58+
private static readonly string _versionDisplay =
59+
_versionFull.Split('+', 2)[0];
60+
}

src/BitLockerKeyMonitor.Web.Azure/Components/Layout/MainLayout.razor.css

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/BitLockerKeyMonitor.Web.Azure/Components/Layout/NavMenu.razor

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/BitLockerKeyMonitor.Web.Azure/Components/Layout/NavMenu.razor.css

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)