Skip to content

Move head-project code into the proper libraries (Windows adapters, JS, CSS)#573

Merged
NikTilton merged 7 commits into
mainfrom
jschick/head-project-restructure
Jun 8, 2026
Merged

Move head-project code into the proper libraries (Windows adapters, JS, CSS)#573
NikTilton merged 7 commits into
mainfrom
jschick/head-project-restructure

Conversation

@jschick04

Copy link
Copy Markdown
Collaborator

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

  • Windows-specific adapters into EventLogExpert.WindowsPlatform: elevation helper process/host, Windows identity provider, restart/native interop.
  • Head JavaScript into collocated ES modules in EventLogExpert.UI: each *.razor.js now sits beside its *.razor.cs, imported as an ES module instead of a global script.
  • MainLayout and the keyboard shortcut service into EventLogExpert.UI: registered through the UI library''s own service-collection extension.
  • Global and feature CSS into EventLogExpert.UI: the design system (app.css) and banner stylesheet move into the UI RCL; the head keeps only the #blazor-error-ui boot shell.

Hardening (surfaced during review)

  • Fixed a ModalChrome JS-module leak when the modal closes while its module import is still in flight.
  • Added an argument null-guard and tightened the doc on the UI service-registration entry point.
  • Unified every UI JS-module disposal catch set to the canonical teardown set (JSDisconnectedException, JSException, ObjectDisposedException, TaskCanceledException) for circuit-teardown resilience.

Testing

  • UI unit tests: 614/614
  • Windows unit tests: 43/43
  • Full solution build: clean (0 warnings, 0 errors)

Stacked on jschick/library-modal-followups.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() in EventLogExpert.WindowsPlatform and wires it into MauiProgram.
  • 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.html to 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.

@jschick04 jschick04 force-pushed the jschick/library-modal-followups branch from 7bf44b2 to f5617a3 Compare June 8, 2026 15:13
Base automatically changed from jschick/library-modal-followups to main June 8, 2026 15:27
@jschick04 jschick04 force-pushed the jschick/head-project-restructure branch from 1e74454 to 742da23 Compare June 8, 2026 15:38
@jschick04 jschick04 marked this pull request as ready for review June 8, 2026 15:40
@jschick04 jschick04 requested a review from a team as a code owner June 8, 2026 15:40
Copilot AI review requested due to automatic review settings June 8, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 52 out of 57 changed files in this pull request and generated 1 comment.

Comment thread src/EventLogExpert.UI/Modal/ModalChrome.razor.cs Outdated
…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.
@jschick04 jschick04 force-pushed the jschick/head-project-restructure branch from 742da23 to ec28367 Compare June 8, 2026 16:10
@NikTilton NikTilton merged commit 1acd8a2 into main Jun 8, 2026
7 checks passed
@NikTilton NikTilton deleted the jschick/head-project-restructure branch June 8, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants