Bugfix Issue 814 Aside Refresh After Test Plan Create - sebiboga/testlink-upgraded GitHub Wiki
Bugfix: Issue #814 — Aside menu does not refresh after creating a test plan; Test Plan sub-menus missing until manual reload
After creating the first test plan of a test project on the modernized Test Plan Management screen, the aside navigation menu did not refresh: the plan-specific sub-entries under Test Plan (Builds / Releases, Add / Remove Test Cases, Add / Remove Platforms, Set Urgent Tests, Update Linked Test Case Versions, Show Test Cases Newest Versions) only appeared after a manual page refresh. Same for the Test Case Execution and Reports sections, which also require a current test-plan context.
- The aside menu is its own frame:
gui/templates/dashio/main.tplloads<iframe src="lib/general/asideMenu.php" id="asidebar">once and leaves it alive across mainframe navigations ("only loads once", per the comment inmain.tpl). -
lib/general/asideMenu.phprenders the Test Plan sub-menu server-side from$_SESSION['testplanID'];gui/templates/dashio/aside.tpladditionally gates the plan entries on$gui->countPlans > 0and non-null$gui->uri->*pointers that only resolve once a current test plan exists. -
initProject()(lib/functions/common.php) auto-selects the first accessible test plan and callssetSessionTestPlan()— which sets$_SESSION['testplanID']— but this only runs when the aside frame re-loads (manual F5 re-runsasideMenu.php→initProject, populating the session and the menu). - The modernized create flow (
api/plans/index.phpPOST →submitPlan()ingui/templates/plans/planView.html) updates the database and the mainframe table but never tells the already-loaded aside frame to reload, so its rendered HTML stayed at the "no plan" state.
Add a shell-level helper reloadAside() in gui/templates/dashio/main.tpl
that reloads iframe#asidebar (same-origin, guarded for a missing frame or
cross-origin errors) and re-syncs the active menu highlight once it finishes
loading (the highlight is normally re-applied on every mainframe onload, so it
would otherwise desync), and call it from gui/templates/plans/planView.html
submitPlan() in the create branch (!editId) only. After it runs,
asideMenu.php re-executes initProject() against a database that now has at
least one plan, so the full Test Plan sub-menu (and the Test Case Execution /
Reports sections) render automatically — reproducing the manual-F5 outcome
without a full page reload.
Why this approach (and what was rejected): reloading the whole page would discard the user's place in the Test Plan Management list; permanently refreshing the aside on every navigation would be wasteful. Refreshing the single plan-context-changing boundary — creating a plan — is the minimal change that matches the reported bug. No new user-facing strings were added, so there is no i18n impact.
-
gui/templates/dashio/main.tpl— addedreloadAside()(reloads the aside iframe and re-syncs the active-link highlight after the reload). -
gui/templates/plans/planView.html—submitPlan()create branch callswindow.parent.reloadAside()when available.
- Syntax gates: extracted inline
<script>ofmain.tplandplanView.html→node --checkboth pass. - In-browser (admin/admin, fresh DB, project "Demo Project" id=1): starting
aside Test Plan sub-menu =
["Test Plan Management"]. After creating "Release 2.0", the aside automatically upgraded to the full Test Plan sub-menu with no reload; Test Case Execution and Reports sections appeared (matching manual-F5 semantics). Creating a second plan kept the full menu; editing a plan (update path) did not spuriously reload the aside. - Event Viewer /
eventstable: no new Error(1)/Warning(2) rows from the fix path (only AUDIT(16) login/plan-create entries). - Regression suite TC-814.1–814.6 recorded in
tmp/TLU_Test_Cases.md: 6/6 PASS.