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

Fixes #37382 - Update to jQuery 3 #10138

Merged
merged 1 commit into from
Jan 22, 2025
Merged

Conversation

@MariaAga MariaAga requested a review from a team as a code owner April 24, 2024 12:46
@github-actions github-actions bot added UI Legacy JS PRs making changes in the legacy Javascript stack labels Apr 24, 2024
@ekohl
Copy link
Member

ekohl commented Apr 24, 2024

I don't see a bump of jquery itself. Is this removing deprecated jquery < 3 usages?

@MariaAga
Copy link
Member Author

@ekohl jquery is in theforeman/foreman-js#479

Comment on lines 172 to 233
$('#check_all_roles').click(function(e) {
$('#check_all_roles').on('click', function(e) {
e.preventDefault();
$('.role_checkbox').prop('checked', true);
});

$('#uncheck_all_roles').click(function(e) {
$('#uncheck_all_roles').on('click', function(e) {
Copy link
Member

Choose a reason for hiding this comment

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

I think these are both unused since acfbc45. There the links with check_all_roles and uncheck_all_roles IDs were removed. They were originally added in feacea3.

I've submitted #10141 to drop them.

I also noticed toggleRowGroup, filter_permissions and typeToIcon are now unused.

Copy link
Member Author

Choose a reason for hiding this comment

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

rebased to include that pr

@@ -1,11 +1,12 @@
group :assets do
gem 'jquery-ui-rails', '~> 6.0'
gem 'jquery-ui-rails', '~> 7.0'
Copy link
Member

Choose a reason for hiding this comment

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

Do we still use this? I don't see anything using this. I get the impression that since b55d3ed it's unused because we no longer have require jquery-ui in the code, but we do still have @import jquery-ui. So we load the CSS, but not any of the actual JS code?

Can we drop it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so #10142

$.fn.bind = function(event, func) {
return this.on(event, func);
};
// used by puppet plugin
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps open a PR against foreman_puppet to drop this usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

Took a while to setup puppet, but made the pr: theforeman/foreman_puppet#403

ekohl
ekohl previously requested changes Jul 18, 2024
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

What's your plan for this? Could we already start using JSON.parse (which AFAIK is native browser functionality)?

Looks like that is also something that needs to be done in multiple repositories. From quickly grepping I find:
https://github.com/theforeman/foreman_puppet/blob/6aa2761cc37bec424c05265a72043706162e3b02/webpack/src/foreman_class_edit.js#L157
https://github.com/theforeman/foreman_puppet/blob/6aa2761cc37bec424c05265a72043706162e3b02/webpack/src/foreman_class_edit.js#L185
https://github.com/theforeman/foreman_openscap/blob/99c00ff3a4c948f660ebe81180cc780c8ff5b0d8/app/assets/javascripts/foreman_openscap/arf_reports.js#L5
https://github.com/Katello/katello/blob/b94f81d09510d135dcc1bdce8a8ef8c2a48c6f39/app/views/katello/sync_management/index.html.erb#L12
https://github.com/Katello/katello/blob/b94f81d09510d135dcc1bdce8a8ef8c2a48c6f39/app/assets/javascripts/katello/common/katello.js#L34

Then another thing we can already do is move to js-cookie. That's something that happens in various repositories. AFAIK jquery's cookie implementation and js-cookie don't conflict, so we can add js-cookie and then migrate various plugins.

@MariaAga
Copy link
Member Author

MariaAga commented Jul 18, 2024

Good idea, I'll move it here: #10250 and will create some prs in the plugins

@MariaAga MariaAga force-pushed the jquery3 branch 2 times, most recently from b518403 to 9cb313e Compare December 3, 2024 11:21
@MariaAga
Copy link
Member Author

MariaAga commented Jan 9, 2025

test failures due to foreman-js not being merged yet probably

jeremylenz
jeremylenz previously approved these changes Jan 13, 2025
Copy link
Contributor

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

Everything seems to work fine! tested several pages in Katello as well as host edit and hostgroup edit

@MariaAga MariaAga force-pushed the jquery3 branch 4 times, most recently from 6654e5b to 775aa72 Compare January 16, 2025 20:37
@ekohl
Copy link
Member

ekohl commented Jan 16, 2025

@MariaAga I'm happy to trust @jeremylenz on his review, but with these bigger changes it can be useful to make some noise on https://community.theforeman.org/c/development/9 that it's happening. Something like https://community.theforeman.org/t/rails-7-0-merge-today/40507 provided a nice place for discussion if it did go wrong. Also something for plugin authors. Pretty sure there are still a few internally maintained plugins by a few users that they need to patch themselves.

@MariaAga
Copy link
Member Author

Thanks @ekohl, I created https://community.theforeman.org/t/updating-to-jquery-3/42023

@jeremylenz
Copy link
Contributor

Ruby Katello failures are unrelated

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

Alright, let's get this in.

@adamruzicka adamruzicka requested a review from ekohl January 20, 2025 16:39
@ekohl
Copy link
Member

ekohl commented Jan 20, 2025

To get this in, we'll need to package foreman-js 14. Do you intend to submit a PR for this or do you need help with it?

@MariaAga
Copy link
Member Author

@ekohl Created theforeman/foreman-packaging#11640 thanks!

@adamruzicka
Copy link
Contributor

There's also theforeman/foreman-packaging#11639 , but I might have gone a little bit overboard with it

@@ -21,7 +21,7 @@
},
"dependencies": {
"@module-federation/utilities": "^1.7.0",
"@theforeman/vendor": "^13.1.0",
"@theforeman/vendor": "^14.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

If we update this, we'll also need to merge #10272, right? It's not that we can merge this without updating to PF5.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eh, but theforeman/foreman-js#481 is still not merged which I assumed was a prerequisite for PF5? Where does that leave us?

Copy link
Member Author

Choose a reason for hiding this comment

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

vendor 14 doesnt include pf5

Copy link
Member

Choose a reason for hiding this comment

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

Ah, so we'll have version 15 soon after? That's the reason why I had preferred to get rid of foreman-js before making big stack upgrades but I guess that's too late now.

@evgeni evgeni dismissed ekohl’s stale review January 22, 2025 09:32

outdated/implemented

@evgeni evgeni merged commit 871a647 into theforeman:develop Jan 22, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Legacy JS PRs making changes in the legacy Javascript stack UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants