Skip to content

Introduce UI for managing Performance Lab standalone plugins. #864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

10upsimon
Copy link
Contributor

@10upsimon 10upsimon commented Oct 19, 2023

Summary

Addresses: #651

Relevant technical choices

  • Created new PerformanceLab\Plugin_Manager class
    • Addition of get_standalone_plugins() static method as a means to reference the available standalone plugins. This will need to be updated in PL plugin releases as more standalone plugins are released to the WordPress plugin directory.
    • Addition of render_plugins_ui() static method as a catch all use-once method to handle rendering of the standalone plugins UI within the PL setting screen. Used within admin/load.php as the main means of rendering the view. This borrows heavily from cores implementation of the UI via Plugins > Add New.
    • Addition of render_plugin_card() static method that handles rendering of the UI for each individual plugin card. This borrows heavily from cores implementation of the UI via Plugins > Add New.
  • Enhancements to admin/load.php
    • Updates to perflab_render_modules_page() function to include a call to Plugin_Manager::render_plugins_ui() in order to render the standalone plugins UI as the first UI section within the PL settings screen.
    • Definition of new callback function perflab_handle_inline_plugin_actions() hooked to action admin_init in order to successfully redirect the end user back to the PL Settings screen upon activation or deactivation of a standalone plugin from the standalone plugins UI rendered within the PL settings screen.
    • Definition of new callback function perflab_admin_scripts hooked to action admin_enqueue_scripts in order to:
      • Enqueue the core updates script, used to handle plugin actions within the rendered UI as a result of PerformanceLab\Plugin_Manager::render_plugins_ui().
      • Localize the updates script via wp_localize_script() and provide the following data:
        • settings An array of settings necessary for correct functionality of plugins script, most notably the totals key which contains plugin update totals, facilitate via a call to wp_get_update_data(). Without this, the updates script does not function as intended as it utilizes this data for retrieving and updating data stores.
      • Enqueues the core thickbox script, necessary for correct lightbox handling from within each plugin UI card.
      • Enqueues the core thickbox style, necessary for correct lightbox appearance as triggered from within each plugin UI card.

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

10upsimon added 28 commits July 20, 2023 11:29
…ation-ui-from-old-modules-to-standalone-plugins
…in applicable load files, enqueue necessary scripts for settings screen.
…Press/performance into feature/creating-standalone-plugins
@10upsimon 10upsimon added [Type] Enhancement A suggestion for improvement of an existing feature [Focus] Standalone Plugins labels Oct 19, 2023
10upsimon and others added 8 commits November 20, 2023 09:56
… of github.com:WordPress/performance into issue/651-pl-settings-screen-manage-standalone-plugins
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
@10upsimon
Copy link
Contributor Author

and _ being more inline etc, the rest of the suggestions from @westonruter have been committed (thank you)._

@10upsimon there are still suggestions that haven't been committed. For example:

Thanks @westonruter I suspect these were being hidden in "outdated" accordions when other changes were made to the same file(s), I've addressed them all in recent commits, thank you.

… of github.com:WordPress/performance into issue/651-pl-settings-screen-manage-standalone-plugins
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@10upsimon As you've pointed out already, there's at least one issue with "over-escaped" content.

@10upsimon
Copy link
Contributor Author

@felixarntz this is ready for the final review, I've removed the over escaping on the author output as identified in a prior comment. I've also removed the unnecessary package-lock.json file change, simply checking out the last commit when this file changed for a reason (10 Aug 2023). This file had changed due to initial iterations I had done on this issue, prior to the refactoring where we decided to use as much of core's updates.js functionality as possible.

@10upsimon 10upsimon requested a review from felixarntz November 21, 2023 07:25
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

Thanks @10upsimon!

@felixarntz felixarntz dismissed westonruter’s stale review November 21, 2023 16:04

Feedback has been addressed

@felixarntz felixarntz merged commit 9dd7e91 into feature/creating-standalone-plugins Nov 21, 2023
@felixarntz felixarntz deleted the issue/651-pl-settings-screen-manage-standalone-plugins branch November 21, 2023 16:04
@felixarntz felixarntz added this to the PL Plugin 2.8.0 milestone Jan 4, 2024
@felixarntz felixarntz added [Type] Feature A new feature within an existing module Infrastructure Issues for the overall performance plugin infrastructure and removed no milestone PRs that do not have a defined milestone for release [Type] Enhancement A suggestion for improvement of an existing feature labels Jan 4, 2024
@felixarntz felixarntz changed the title Issue / 651 PL Settings Screen Manage Standalone Plugins Introduce UI for managing Performance Lab standalone plugins. Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Feature A new feature within an existing module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants