Move head-project code into the proper libraries (Windows adapters, JS, CSS)#573
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the MAUI head project to act as a thin composition root by relocating Windows-specific adapters and UI assets (JS/CSS/layout/services) into the appropriate libraries (EventLogExpert.WindowsPlatform, EventLogExpert.UI), while hardening JS-module lifecycle/disposal behavior.
Changes:
- Introduces
AddWindowsPlatformAdapters()inEventLogExpert.WindowsPlatformand wires it intoMauiProgram. - Converts multiple UI JavaScript helpers from global
window.*scripts to ES modules (including Razor-collocated*.razor.js) and updates components + tests accordingly. - Moves global/feature CSS into the UI RCL and updates
index.htmlto reference_content/EventLogExpert.UI/...assets.
Reviewed changes
Copilot reviewed 52 out of 57 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/EventLogExpert.Windows.Tests/DependencyInjection/WindowsPlatformServiceCollectionExtensionsTests.cs | Adds DI coverage for AddWindowsPlatformAdapters() registrations. |
| tests/Unit/EventLogExpert.UI.Tests/Menu/MenuHostRegistryTests.cs | Extends UI DI tests to cover KeyboardShortcutService registration. |
| tests/Unit/EventLogExpert.UI.Tests/Menu/MenuHostHandoffTests.cs | Updates bUnit JS interop expectations to module-based MenuOverlay calls. |
| tests/Unit/EventLogExpert.UI.Tests/FilterLibrary/LibraryEntryRowTests.cs | Updates bUnit JS interop to use module-based MenuAnchor + row module. |
| src/EventLogExpert/wwwroot/js/event_table.js | Removes head-level table JS (replaced by UI module). |
| src/EventLogExpert/wwwroot/js/details_pane.js | Removes head-level details-pane JS (replaced by UI module). |
| src/EventLogExpert/wwwroot/js/app.js | Removes global scroll helper (moved to Razor-collocated module). |
| src/EventLogExpert/wwwroot/index.html | Switches CSS to UI RCL content and removes now-obsolete global scripts. |
| src/EventLogExpert/wwwroot/css/manage-status-banner.css | Removes head-level manage-status CSS (moved into UI component CSS). |
| src/EventLogExpert/wwwroot/css/app.css | Trims head CSS down to boot-shell/error UI concerns + fallback z-index. |
| src/EventLogExpert/MauiProgram.cs | Composes the app using AddWindowsPlatformAdapters() and removes direct keyboard service registration. |
| src/EventLogExpert/DependencyInjection/MauiProgramExtensions.cs | Removes Windows-specific adapter registrations from MAUI host extension set. |
| src/EventLogExpert/Components/Layout/MainLayout.razor.cs | Removes head-project MainLayout code-behind (moved into UI library). |
| src/EventLogExpert/_Imports.razor | Updates imports to use UI library layout namespace. |
| src/EventLogExpert.WindowsPlatform/Restart/WindowsApplicationRestartService.cs | Moves restart service into WindowsPlatform namespace and minor formatting. |
| src/EventLogExpert.WindowsPlatform/Restart/RestartFlags.cs | Moves restart flags into WindowsPlatform namespace. |
| src/EventLogExpert.WindowsPlatform/Restart/NativeMethods.cs | Moves P/Invoke wrapper into WindowsPlatform namespace. |
| src/EventLogExpert.WindowsPlatform/Identity/WindowsIdentityProvider.cs | Moves identity provider into WindowsPlatform namespace. |
| src/EventLogExpert.WindowsPlatform/Elevation/ElevatedHelperProcessHost.cs | Renames/moves elevated helper host into WindowsPlatform and updates logging/type names. |
| src/EventLogExpert.WindowsPlatform/Elevation/ElevatedHelperProcess.cs | Renames/moves elevated helper handle into WindowsPlatform and updates docs/logging. |
| src/EventLogExpert.WindowsPlatform/DependencyInjection/WindowsPlatformServiceCollectionExtensions.cs | Adds WindowsPlatform DI extension for host composition. |
| src/EventLogExpert.UI/wwwroot/Menu/MenuOverlay.js | Converts menu overlay helpers to ES module exports and removes unrelated globals. |
| src/EventLogExpert.UI/wwwroot/Menu/MenuAnchor.js | Adds ES module providing getMenuElementRect. |
| src/EventLogExpert.UI/wwwroot/Keyboard/Keyboard.js | Converts keyboard bridge to ES module exports. |
| src/EventLogExpert.UI/wwwroot/Banner/banner.css | Moves banner styling into UI RCL static content. |
| src/EventLogExpert.UI/wwwroot/app.css | Moves design-system/global UI CSS into UI RCL static content. |
| src/EventLogExpert.UI/UiServiceCollectionExtensions.cs | Adds UI-library DI extension registering menu registry + keyboard shortcuts service. |
| src/EventLogExpert.UI/Modal/SidebarTabs.razor.js | Adds Razor-collocated JS module for tablist key handling. |
| src/EventLogExpert.UI/Modal/SidebarTabs.razor.cs | Updates module import path and expands teardown exception handling. |
| src/EventLogExpert.UI/Modal/ModalChrome.razor.js | Converts modal open/close helpers to ES module exports. |
| src/EventLogExpert.UI/Modal/ModalChrome.razor.cs | Migrates modal JS calls to module import + disposal; adds in-flight close hardening. |
| src/EventLogExpert.UI/Menu/MenuServiceCollectionExtensions.cs | Removes older UI DI extension (superseded by UiServiceCollectionExtensions). |
| src/EventLogExpert.UI/Menu/MenuRenderer.razor.js | Adds Razor-collocated JS module for scrolling focused menu items into view. |
| src/EventLogExpert.UI/Menu/MenuRenderer.razor.cs | Adds JS module imports and disposal for submenu positioning + item scrolling. |
| src/EventLogExpert.UI/Menu/MenuHost.razor.cs | Migrates menu host JS calls to MenuOverlay ES module and disposes module on teardown. |
| src/EventLogExpert.UI/Menu/MenuBar.razor.cs | Migrates menu anchoring to MenuAnchor module; updates disposal to async module disposal. |
| src/EventLogExpert.UI/LogTable/LogTablePane.razor.js | Adds Razor-collocated JS module replacing removed head-level event_table.js. |
| src/EventLogExpert.UI/LogTable/LogTablePane.razor.css | Updates comment to reflect new module name for injected resize handles. |
| src/EventLogExpert.UI/LogTable/LogTablePane.razor.cs | Migrates table JS interop to module import + disposal and guards calls when module missing. |
| src/EventLogExpert.UI/LogTable/LogTabBar.razor.js | Converts log tab bar initialization to ES module export. |
| src/EventLogExpert.UI/LogTable/LogTabBar.razor.cs | Imports + disposes log tab bar module instead of using a global. |
| src/EventLogExpert.UI/Layout/MainLayout.razor.js | Adds Razor-collocated JS module for applying theme. |
| src/EventLogExpert.UI/Layout/MainLayout.razor.css | Adds skip-link styling for keyboard navigation. |
| src/EventLogExpert.UI/Layout/MainLayout.razor.cs | Adds UI library MainLayout code-behind with module-based theme handling and disposal. |
| src/EventLogExpert.UI/Layout/MainLayout.razor | Adds UI library MainLayout markup (composition of UI components). |
| src/EventLogExpert.UI/Keyboard/KeyboardShortcutService.cs | Migrates keyboard shortcut bridge to module import + robust module disposal. |
| src/EventLogExpert.UI/Inputs/ValueSelect.razor.js | Converts dropdown JS helpers to ES module exports and internal cleanup. |
| src/EventLogExpert.UI/Inputs/ValueSelect.razor.cs | Imports dropdown module and routes JS calls through module reference with disposal. |
| src/EventLogExpert.UI/FilterPane/FilterPane.razor.cs | Migrates menu anchoring to MenuAnchor module and disposes module on teardown. |
| src/EventLogExpert.UI/FilterLibrary/LibraryEntryRow.razor.js | Adds Razor-collocated scroll helper module (replaces removed head global). |
| src/EventLogExpert.UI/FilterLibrary/LibraryEntryRow.razor.cs | Imports/disposes row + MenuAnchor modules and routes interop through them. |
| src/EventLogExpert.UI/DetailsPane/DetailsPane.razor.js | Adds module replacing removed head-level details_pane.js. |
| src/EventLogExpert.UI/DetailsPane/DetailsPane.razor.cs | Imports/disposes details pane module and routes resizer interop through it. |
| src/EventLogExpert.UI/DatabaseTools/Tabs/ManageDatabasesTab.razor.css | Moves manage-status banner styling into component-scoped CSS. |
| src/EventLogExpert.UI/DatabaseTools/DatabaseToolsLogView.razor.js | Adds Razor-collocated module for scroll pinning + jump-to-latest behavior. |
| src/EventLogExpert.UI/DatabaseTools/DatabaseToolsLogView.razor.cs | Updates module import path and hardens module disposal exception handling. |
| src/EventLogExpert.UI/_Imports.razor | Expands UI RCL imports to cover relocated components/namespaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7bf44b2 to
f5617a3
Compare
1e74454 to
742da23
Compare
…disposal and tag membership Address the last-minute review findings flagged on #572 and #573 after switching off draft: - ModalChrome.CloseAsync: replace the bare catch with this file's established teardown set (JSDisconnectedException, JSException, ObjectDisposedException, TaskCanceledException) so non-teardown failures surface instead of being silently swallowed, matching DisposeAsync. - FilterLibraryModal / FilterPane row disposal: drop the O(n) ReferenceEquals scan over _rowRefs. LibraryEntryRow.OnDisposed now passes (ActiveTab, Entry.Id) and FilterRow.OnDisposed passes the owning FilterId (only when Value is non-null), so each handler removes its dictionary key in O(1). This is safe because both row loops are @key'd by id, giving a stable key-to-instance mapping; PruneStaleRowRefs remains as the render-time backstop. - FilterLibraryModal.SelectedTagsInLibrary: build a case-insensitive HashSet from the current entries' tags for O(1) membership instead of rebuilding the sorted-distinct AllLibraryTags list on every call. Disposal tests updated to the new OnDisposed callback contracts.
742da23 to
ec28367
Compare
NikTilton
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relocates code that lived in the MAUI head/executable project into the libraries where it belongs (Separation of Concerns + Vertical Slice Architecture), keeping the head a thin composition root. The moves preserve behavior; the only logic touched is review-surfaced lifecycle hardening.
What moved
EventLogExpert.WindowsPlatform: elevation helper process/host, Windows identity provider, restart/native interop.EventLogExpert.UI: each*.razor.jsnow sits beside its*.razor.cs, imported as an ES module instead of a global script.MainLayoutand the keyboard shortcut service intoEventLogExpert.UI: registered through the UI library''s own service-collection extension.EventLogExpert.UI: the design system (app.css) and banner stylesheet move into the UI RCL; the head keeps only the#blazor-error-uiboot shell.Hardening (surfaced during review)
ModalChromeJS-module leak when the modal closes while its module import is still in flight.catchset to the canonical teardown set (JSDisconnectedException,JSException,ObjectDisposedException,TaskCanceledException) for circuit-teardown resilience.Testing
Stacked on
jschick/library-modal-followups.