Skip to content
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

🚧 Update provider js assets #4000

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

josemigallas
Copy link
Contributor

@josemigallas josemigallas commented Jan 31, 2025

Disclaimer: this PR is not about updating every usage of jQuery but to prepare the ground for removing jQuery 1 altogether. We need to identify where it's used, why and what for in order to eliminate every possibility of a breaking chang.

This is part of THREESCALE-9982: Unify jquery across 3scale.

layout/provider.js imports a lot of old scripts and libraries that (some) depend on jquery:

//= require vendor/jquery
//= require highlight/highlight.pack.js
//= require remote
//= require switch
//= require ajax_events
//= require extra_fields
//= require vendor/underscore.min.js
//= require provider
//= require vendor/jquery.iframe-post-form.js
//= require vendor/colorbox/jquery.colorbox.js
//= require threescale
//= require vendor/pluralize
//= require master_application
//= require flash

By moving them into webpack we gain typings and have more control over its use of jquery, therefore making it easier to upgrade.

Verification instructions

⚠️ Hard to say! But here is some info about what each script do:

  • ajax_events: adds/removes a spinner to the screen when ajax is used (asynchronous requests via JS). These events are triggered by window.$ (that is, jquery v1) so it's necessary to set event handlers to jquery 1. Ajax is used by jquery-rails, rails_ujs and other similar libraries that are managed by bundler. These libraries are all plugged into window.$.
  • remote: this one is very important. The script sets up all remote forms and links (with class .remote) that are to send an ajax request to rails and receive a JS response, instead of loading the whole page again. This should be easy to test, look for forms and links with class remote (or prop remote: true) and verify that using then do not reload the page.
  • More to do...

@josemigallas josemigallas self-assigned this Jan 31, 2025
@josemigallas josemigallas force-pushed the provider_js_to_webpack_assets branch from 41c8d64 to a95a826 Compare February 6, 2025 10:56
Copy link
Contributor

@jlledom jlledom left a comment

Choose a reason for hiding this comment

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

Pretty hard to review this, I don't know what should I try. Apparently there's a legit cucumber failure. I'll approve if it's fixed.

@josemigallas
Copy link
Contributor Author

Pretty hard to review this, I don't know what should I try. Apparently there's a legit cucumber failure. I'll approve if it's fixed.

I will split this up in smaller PRs if they make sense.

@josemigallas josemigallas force-pushed the provider_js_to_webpack_assets branch from 2ad3a9b to 5c66fe7 Compare February 14, 2025 09:21
@mayorova
Copy link
Contributor

Maybe convert this PR into draft, because it seems that it is being split in multiple PRs (which is a good idea) ?

@josemigallas josemigallas force-pushed the provider_js_to_webpack_assets branch from 993cd30 to 805e313 Compare February 27, 2025 12:15
@josemigallas josemigallas force-pushed the provider_js_to_webpack_assets branch from 805e313 to beeafd6 Compare March 4, 2025 11:06
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.

3 participants