Skip to content

refactor: DRY gexport page layout wrapper#65

Open
somethingwithproof wants to merge 1 commit intoCacti:developfrom
somethingwithproof:fix/dry-layout-64
Open

refactor: DRY gexport page layout wrapper#65
somethingwithproof wants to merge 1 commit intoCacti:developfrom
somethingwithproof:fix/dry-layout-64

Conversation

@somethingwithproof
Copy link

Summary

  • add a shared gexport_render_with_layout() helper for page wrapper rendering
  • route edit and default action paths in gexport.php through the helper
  • preserve behavior while removing duplicated top_header()/bottom_footer() wrapper logic

Tests

  • php -l gexport.php
  • php -l ui_helpers.php
  • php -l tests/test_layout_wrapper.php
  • php tests/test_layout_wrapper.php

Closes #64

Copilot AI review requested due to automatic review settings March 15, 2026 23:12
Copy link

Copilot AI left a comment

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 gexport UI routing to remove duplicated page layout wrapper logic by introducing a shared helper, and adds a small regression test to confirm wrapper call ordering and routing usage.

Changes:

  • Add gexport_render_with_layout() helper to centralize top_header()/content/bottom_footer() rendering.
  • Route the edit and default gexport.php actions through the new helper.
  • Add a standalone regression test covering wrapper ordering and verifying the helper is used in routing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
ui_helpers.php Introduces the shared layout wrapper helper used by gexport UI routes.
gexport.php Uses the shared wrapper helper for edit and default action rendering paths.
tests/test_layout_wrapper.php Adds a standalone regression test for wrapper ordering and route usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +53 to +60
assert_true(
'edit action uses shared layout helper',
strpos($source, "gexport_render_with_layout('export_edit');") !== false
);
assert_true(
'default action uses shared layout helper',
strpos($source, "gexport_render_with_layout('gexport');") !== false
);
Comment on lines +55 to +59
strpos($source, "gexport_render_with_layout('export_edit');") !== false
);
assert_true(
'default action uses shared layout helper',
strpos($source, "gexport_render_with_layout('gexport');") !== false
Comment on lines +9 to +10
| of the License, or (at your option) any later version. |
+-------------------------------------------------------------------------+
*/

if (!function_exists('gexport_render_with_layout')) {
function gexport_render_with_layout($renderer) {
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.

refactor: DRY gexport page layout wrapper

2 participants