Skip to content

fix(menu): stop creating the dead Reports menu item and remove existing ones (#2136) - #2137

Merged
renemadsen merged 1 commit into
stablefrom
fix/2136-remove-dead-reports-menu
Oct 4, 2026
Merged

renemadsen merged 1 commit into
stablefrom
fix/2136-remove-dead-reports-menu

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Summary

  • GetNavigationMenu and HeaderMenu no longer offer the "Reports" entry (/plugins/items-planning-pn/reports).
  • On plugin start, Configure removes existing dead entries from the host's Angular database via the new DeadReportsMenuCleaner. It removes the menu items with their translations and security groups, plus the menu template with its translations and template-permission rows. Only rows carrying both the dead link and the items-planning-pn-reports E2E id are touched. Any other item still pointing at the removed template is detached (MenuTemplateId = null), as the host does when it removes a plugin's templates. A second start is a no-op. Removed ids are logged, and a failure is caught and logged without stopping the host.
  • Adds Microting.EformAngularFrontendBase 10.0.40, the same version eform-angular-frontend stable and the time-planning plugin use, so BaseDbContext types match at runtime.

Root cause

The reports route was removed from the Angular module in 2023, but the plugin kept registering the menu entry. Clicking it matches no route, and the frontend's catch-all {path: '**', redirectTo: ''} silently lands the user on "My eForms". The host only ever adds plugin menu templates on start; it never removes them. So dropping the entry from GetNavigationMenu alone would leave the existing dead items in place.

Tests

  • DeadReportsMenuCleanupTests (Testcontainers MariaDB, runs Configure the way the host does). It checks:
    • the dead item and template plus their child rows are removed
    • the Planning entry, the dropdown and BaseDbContext's own seeded menu are unchanged (snapshot-based)
    • an item re-pointed elsewhere but still on the dead template is kept and detached
    • a second start changes nothing
    • Configure without a registered BaseDbContext does not throw
  • NavigationMenuTests: GetNavigationMenu and HeaderMenu no longer contain the reports link or E2E id.

Not verified

  • The tests have not run locally; they run in CI only.
  • Not tested against a running host. The cleanup was not run against any real installation.

Refs #2136

🤖 Generated with Claude Code

…ng ones (#2136)

The reports route left the Angular module in 2023, but the plugin kept
registering a "Reports" menu entry for /plugins/items-planning-pn/reports.
Clicking it matches no route and the frontend's catch-all silently lands
on "My eForms".

GetNavigationMenu and HeaderMenu no longer offer the entry. Because the
host only ever adds plugin menu entries, Configure now removes the dead
item and template (with translations, security groups and template
permissions) from the host's Angular database on plugin start. Only rows
carrying both the dead link and its E2E id are touched; a second start is
a no-op, and a failure is logged without stopping the host.

Adds Microting.EformAngularFrontendBase 10.0.40, the version the host and
the time-planning plugin use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 3, 2026 05:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The cleanup is narrowly targeted, failure-tolerant, idempotent, and covered by focused integration tests.

Review effort: Balanced
Findings: None

What changed in this PR

Removes the obsolete Reports navigation entry and cleans up existing database records safely during plugin startup.

Changes:

  • Removes Reports from both navigation menu implementations.
  • Adds idempotent database cleanup with failure logging.
  • Adds integration and menu regression tests.
File Description
ItemsPlanning.Pn.csproj Adds the host database dependency.
DeadReportsMenuCleaner.cs Removes dead menu records and dependencies.
EformItemsPlanningPlugin.cs Runs cleanup and stops registering Reports.
NavigationMenuTests.cs Verifies Reports is no longer offered.
DeadReportsMenuCleanupTests.cs Tests cleanup, preservation, and idempotency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@renemadsen
renemadsen merged commit 118afcc into stable Oct 4, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Assignees

Couldn't load assignees.