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 #26181 - move settings.js to webpack #6517

Closed
wants to merge 1 commit into from

Conversation

amirfefer
Copy link
Member

No description provided.

@theforeman-bot
Copy link
Member

Issues: #26181

@ohadlevy
Copy link
Member

thanks @amirfefer every change that remove a full page reload between page loads is a great improvement!

@@ -8,7 +8,6 @@
//= require vendor
//= require jquery.extentions
//= require jquery.multi-select
//= require settings
Copy link
Member

Choose a reason for hiding this comment

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

actually, re-reading this, it looks like settings was always in the application bundle, hence it didn't really trigger a full page reload....

@amirfefer
Copy link
Member Author

@ekohl, @ohadlevy would you mind to have another look?


$(document).ready(() => {
if (window.location.pathname === window.foreman_url('/settings')) {
$('.editable').editable({
Copy link
Member

Choose a reason for hiding this comment

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

This is probably my lack of knowledge, but how does this get the editable since it's a plugin? Do you need to import the plugin or does it rely on some side effect somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

interesting... we require it over the assets pipeline

//= require editable/bootstrap-editable
//= require editable/rails

in application.js, and we load application.js after webpack files, therefore it works

Copy link
Member

Choose a reason for hiding this comment

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

That sounds rather fragile to rely on the classic pipeline in the webpack pipeline. AFAIK the settings are all defined in Foreman models with the actual values being added by plugins. That means the page is probably not modified by plugins. Wouldn't it be better to rewrite it to react rather than to risk breaking it by moving things if there's no actual gain right now?

Copy link
Member

Choose a reason for hiding this comment

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

Also, are we sure editable isn't used by any other code? Any plugins using the x-editable-rails gem?

@@ -0,0 +1,14 @@
import $ from 'jquery';

$(document).ready(() => {
Copy link
Member

Choose a reason for hiding this comment

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

use on content load event?


$(document).ready(() => {
if (window.location.pathname === window.foreman_url('/settings')) {
$('.editable').editable({
Copy link
Member

Choose a reason for hiding this comment

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

this will register the callback each time you go to a screen like that, is there a chance it will create multiple on click events or similar?

@ohadlevy
Copy link
Member

@amirfefer whats the status of this PR? thanks

@Ron-Lavi
Copy link
Member

can you rebase ? :)

@tbrisker
Copy link
Member

@amirfefer do you intend to continue working on this or shall we close it?

@amirfefer
Copy link
Member Author

@tbrisker - I'm focusing on other things atm, closing this for now.

@amirfefer amirfefer closed this Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants