refactor: DRY gexport page layout wrapper#65
Open
somethingwithproof wants to merge 1 commit intoCacti:developfrom
Open
refactor: DRY gexport page layout wrapper#65somethingwithproof wants to merge 1 commit intoCacti:developfrom
somethingwithproof wants to merge 1 commit intoCacti:developfrom
Conversation
There was a problem hiding this comment.
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 centralizetop_header()/content/bottom_footer()rendering. - Route the
editand defaultgexport.phpactions 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) { |
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
gexport_render_with_layout()helper for page wrapper renderingeditand default action paths ingexport.phpthrough the helpertop_header()/bottom_footer()wrapper logicTests
php -l gexport.phpphp -l ui_helpers.phpphp -l tests/test_layout_wrapper.phpphp tests/test_layout_wrapper.phpCloses #64