-
Notifications
You must be signed in to change notification settings - Fork 998
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 #27903 - Do not init template-form-elements #7057
Fixes #27903 - Do not init template-form-elements #7057
Conversation
@m-bucher, the Redmine ticket used is for a different project than the one associated with this GitHub repository. Please either:
If changing the ticket number used, remember to update the PR title and the commit message (using This message was auto-generated by Foreman's prprocessor |
Issues: #27902 |
f8463ca
to
567d00a
Compare
8165727
to
6922d7e
Compare
Looks good overall @m-bucher, I agree this probably should go in (I would only like to make sure, we are not depending on the form_template to be initialized somewhere, but I wouldn't guess so. |
[test katello] |
[test foreman] |
@ezr-ondrej , just tried the patch, but it did not fix the broken spinner-elements. I agree, we should make sure that this does not break anything. However, I do not know if other plugins use these elements in form-templates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works and the implementation make sense, only the argument check is bit tricky. Could we improve it a bit?
6922d7e
to
6feaf19
Compare
12055f3
to
5dd656e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks good already, thanks for the event handling, looks better now!
Just one idea I came up with - bit more readable implementation of the parent checking. Let me know if you want to use it, if not, I am ok to merge as is :)
export function initByte() { | ||
$('input.byte_spinner').each(function() { | ||
export function initByte(selection = null) { | ||
$('input.byte_spinner', selection).each(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that with this:
$('input.byte_spinner', selection).each(function() { | |
$('input.byte_spinner, selection).not('.form_template input.byte_spinner').each(function() { | |
// .... |
we could leave out the if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I just added it.
eslint thinks the lines are too long, so it resulted in some code reformatting.
fixes problem with not initialized counter and byte-size input elements within dynamically added volumes of compute-resources in host-create
5dd656e
to
9e29589
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @m-bucher 👍 good job with the JS fight! 😍 👏
fixes problem with not initialized counter and byte-size input elements
within dynamically added volumes of compute-resources in host-create
This fixed the error for me on https://github.com/theforeman/foreman_fog_proxmox, but I am open for better solutions 😉